QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#526387 | #8777. Passport Stamps | megumi# | WA | 3ms | 5144kb | C++14 | 777b | 2024-08-21 15:07:28 | 2024-08-21 15:07:28 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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'