QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#526387#8777. Passport Stampsmegumi#WA 3ms5144kbC++14777b2024-08-21 15:07:282024-08-21 15:07:28

Judging History

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

  • [2024-08-21 15:07:28]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:5144kb
  • [2024-08-21 15:07:28]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int __int128
const int mod = 998244353;
inline int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9')
        f = (c == '-') ? -1 : 1, c = getchar();
    while (c >= '0' && c <= '9')
        x = x * 10 + c - 48, c = getchar();
    return f * x;
}
int a[100005];
signed main() {
    int n = read(), p = read(), ans = 0;
    for (int i = 1; i <= n; i++)
        a[i] = read();
    sort(a + 1, a + n + 1);
    for (int i = 1; i <= n; i++) {
        int x = a[i];
        int y = p / (ans + 1);
        if (p % (ans + 1) != 0)
            y++;
        if (y < x)
            cout << (long long)(i - 1), exit(0);
        ans += x;
    }
    cout << (long long)n;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3576kb

input:

5 15
1
2
3
4
5

output:

3

result:

ok single line: '3'

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 5144kb

input:

100000 559309580160692839
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
...

output:

99999

result:

wrong answer 1st lines differ - expected: '84437', found: '99999'