QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#426017 | #7614. Boxes | real_sigma_team# | WA | 35ms | 3612kb | C++20 | 618b | 2024-05-30 20:20:45 | 2024-05-30 20:20:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (int &i : a)
cin >> i;
sort(a.begin(), a.end());
multiset<int> now;
for (int i = 0; i < n; ++i) {
int cur = 0;
while (!now.empty() && *now.begin() + cur <= a[i] / 2) {
cur += *now.begin();
now.erase(now.begin());
}
now.insert(a[i]);
}
cout << now.size() << '\n';
}
signed main() {
cin.tie(nullptr)->sync_with_stdio(false);
int t;
cin >> t;
while (t--)
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3496kb
input:
4 5 1 2 1 1 8 3 1 1 1 6 1 1 1 4 1 2 3 8 4 2
output:
1 3 3 1
result:
ok 4 lines
Test #2:
score: 0
Accepted
time: 35ms
memory: 3612kb
input:
500000 1 137438953472 1 8589934592 1 2048 1 1048576 1 68719476736 1 524288 1 8192 1 536870912 1 16777216 1 549755813888 1 268435456 1 524288 1 8589934592 1 32768 1 32768 1 32 1 131072 1 2 1 524288 1 34359738368 1 8589934592 1 8192 1 68719476736 1 8589934592 1 524288 1 268435456 1 68719476736 1 26214...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 500000 lines
Test #3:
score: -100
Wrong Answer
time: 14ms
memory: 3612kb
input:
1299 360 131072 4294967296 67108864 4294967296 1 16384 16384 16384 268435456 67108864 268435456 2048 4294967296 16384 64 16384 68719476736 4 524288 134217728 131072 131072 134217728 134217728 67108864 64 16384 2147483648 1024 4 64 131072 67108864 131072 134217728 2048 131072 134217728 17179869184 67...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
wrong answer 1st lines differ - expected: '17', found: '1'