QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#27833 | #2616. Attack Order | Geothermal# | WA | 3ms | 3560kb | C++ | 1.2kb | 2022-04-11 01:15:09 | 2022-04-28 12:01:26 |
Judging History
answer
#include <bits/stdc++.h>
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;
sort(all(A), [](const pi &a, const pi &b) {
if (a.f != b.f) return a.f < b.f;
return a.s > b.s;
});
F0R(i, N-1) {
int cur = A[i].f;
FOR(j, i+1, N) {
cur += A[j].s;
}
if (cur > A[i+1].f) {
cout << "No" << nl; return;
}
}
cout << "Yes" << nl;
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int T; cin >> T;
while(T--) {
solve();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 3ms
memory: 3556kb
input:
3 2 15 25 10 5 3 7 0 7 3 10 0 3 10 10 20 20 30 30
output:
Yes Yes No
result:
ok 3 token(s): yes count is 2, no count is 1
Test #2:
score: -100
Wrong Answer
time: 3ms
memory: 3560kb
input:
1000 4 0 1 0 2 2 2 0 0 4 2 2 1 1 1 1 0 0 4 2 1 1 2 1 0 2 1 3 2 1 1 0 1 1 4 2 0 2 2 1 2 1 2 3 1 0 3 0 0 3 4 1 1 1 0 1 2 1 2 2 1 2 3 1 4 1 2 1 0 2 0 0 2 2 3 3 0 2 4 2 0 1 0 2 1 0 1 3 1 1 1 0 0 3 4 1 1 2 1 0 2 1 1 4 1 2 2 2 1 0 2 1 4 0 0 1 0 0 1 0 1 3 0 1 2 3 0 0 3 3 1 3 2 1 1 4 1 0 0 0 1 1 2 1 4 2 1 1...
output:
No No No No No No No Yes No Yes No Yes No No No Yes No No No No No No No No No Yes No Yes No No Yes No No Yes Yes No No No No No No No No No Yes No No No Yes Yes No Yes No No No No Yes No No No No No No No Yes No No No No No Yes No No No No No No No No No No No No No No No No No No No No No Yes No N...
result:
wrong answer expected NO, found YES [12th token]