QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#27830#2616. Attack OrderGeothermal#Compile Error//C++1.2kb2022-04-11 01:11:122022-05-18 04:21:16

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-18 04:21:16]
  • 评测
  • [2022-04-11 01:11:12]
  • 提交

answer


using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b) - 1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a) - 1; i >= 0; i--)

#define sz(x) (int) (x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ub upper_bound
#define lb lower_bound
#define all(x) x.begin(), x.end()

const char nl = '\n';

void solve() {
	int N; cin >> N;
	vpl A(N); F0R(i, N) cin >> A[i].f;
	F0R(i, N) cin >> A[i].s;

	F0R(iter, N-1) {
		sort(all(A));
		ll sum = 0;
		F0R(i, N) {
			sum += A[i].s;
		}
		F0Rd(i, N) {
			int p = 0; if (i == 0) p = 1;
			if (A[i].f + sum - A[i].s <= A[p].f) {
				A.erase(A.begin() + p); goto done;
			}
		}
		cout << "No" << nl; return;
		done:
		;
	}
	cout << "Yes" << nl;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int T; cin >> T;
	while(T--) {
		solve();
	}

}

Details

answer.code:6:9: error: ‘pair’ does not name a type
    6 | typedef pair<int, int> pi;
      |         ^~~~
answer.code:7:9: error: ‘pair’ does not name a type
    7 | typedef pair<ll, ll> pl;
      |         ^~~~
answer.code:8:9: error: ‘pair’ does not name a type
    8 | typedef pair<ld, ld> pd;
      |         ^~~~
answer.code:9:9: error: ‘vector’ does not name a type
    9 | typedef vector<int> vi;
      |         ^~~~~~
answer.code:10:9: error: ‘vector’ does not name a type
   10 | typedef vector<ld> vd;
      |         ^~~~~~
answer.code:11:9: error: ‘vector’ does not name a type
   11 | typedef vector<ll> vl;
      |         ^~~~~~
answer.code:12:9: error: ‘vector’ does not name a type
   12 | typedef vector<pi> vpi;
      |         ^~~~~~
answer.code:13:9: error: ‘vector’ does not name a type
   13 | typedef vector<pl> vpl;
      |         ^~~~~~
answer.code: In function ‘void solve()’:
answer.code:32:16: error: ‘cin’ was not declared in this scope
   32 |         int N; cin >> N;
      |                ^~~
answer.code:1:1: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
  +++ |+#include <iostream>
    1 | 
answer.code:33:9: error: ‘vpl’ was not declared in this scope
   33 |         vpl A(N); F0R(i, N) cin >> A[i].f;
      |         ^~~
answer.code:33:36: error: ‘A’ was not declared in this scope
   33 |         vpl A(N); F0R(i, N) cin >> A[i].f;
      |                                    ^
answer.code:34:26: error: ‘A’ was not declared in this scope
   34 |         F0R(i, N) cin >> A[i].s;
      |                          ^
answer.code:37:26: error: ‘A’ was not declared in this scope
   37 |                 sort(all(A));
      |                          ^
answer.code:27:16: note: in definition of macro ‘all’
   27 | #define all(x) x.begin(), x.end()
      |                ^
answer.code:37:17: error: ‘sort’ was not declared in this scope; did you mean ‘short’?
   37 |                 sort(all(A));
      |                 ^~~~
      |                 short
answer.code:48:17: error: ‘cout’ was not declared in this scope
   48 |                 cout << "No" << nl; return;
      |                 ^~~~
answer.code:48:17: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
answer.code:52:9: error: ‘cout’ was not declared in this scope
   52 |         cout << "Yes" << nl;
      |         ^~~~
answer.code:52:9: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
answer.code: In function ‘int main()’:
answer.code:56:9: error: ‘ios_base’ has not been declared
   56 |         ios_base::sync_with_stdio(0); cin.tie(0);
      |         ^~~~~~~~
answer.code:56:39: error: ‘cin’ was not declared in this scope
   56 |         ios_base::sync_with_stdio(0); cin.tie(0);
      |                                       ^~~
answer.code:56:39: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?