QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#399579#7614. BoxesNyansTL 1ms3920kbC++14473b2024-04-26 15:21:082024-04-26 15:21:08

Judging History

This is the latest submission verdict.

  • [2024-04-26 15:21:08]
  • Judged
  • Verdict: TL
  • Time: 1ms
  • Memory: 3920kb
  • [2024-04-26 15:21:08]
  • Submitted

answer

#include <bits/stdc++.h>
int n;
long long a[100010];
int main() {
    int T;
    scanf("%d", &T);
    while (T--) {
        scanf("%d", &n);
        for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
        std::sort(a + 1, a + n + 1);
        int j = 1;
        for (int i = 1; i <= n; i++) {
            long long remain = a[i] / 2;
            while (remain >= a[j])
                remain -= a[j++];
        }
        printf("%d\n", n - j + 1);
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3920kb

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: -100
Time Limit Exceeded

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:

-100008
-100008
1
1
-100008
1
1
1
1
-100008
1
1
-100008
1
1
1
1
1
1
-100008
-100008
1
-100008
-100008
1
1
-100008
1
1
1
1
1
-100008
1
1
1
1
1
1
1
1
1
1
1
-100008
1
1
1
1
1
1
1
-100008
1
1
1
1
-100008
1
1
1
-100008
1
-100008
-100008
1
1
1
1
1
1
1
1
1
1
-100008
1
-100008
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result: