QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#819139 | #964. Excluded Min | lgvc | WA | 1ms | 5956kb | C++23 | 487b | 2024-12-18 13:01:17 | 2024-12-18 13:01:23 |
Judging History
answer
#include <bits/stdc++.h>
int N,Q,a[500009],v[500009];
signed main(void) {
scanf("%d %d",&N,&Q);
for(int i=1;i<=N;i++) {
scanf("%d",&a[i]);
}
while(Q--) {
int l,r;
scanf("%d %d",&l,&r);
for(int i=l;i<=r;i++) {
v[a[i]]++;
}
int su=0,ans=0;
for(int i=0;i<=r-l+1;i++) {
if(su>=i) ans=i;
su+=v[i];
v[i]=0;
}
printf("%d\n",ans);
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5936kb
input:
3 3 0 0 2 1 3 2 3 3 3
output:
3 1 0
result:
ok 3 number(s): "3 1 0"
Test #2:
score: 0
Accepted
time: 0ms
memory: 5956kb
input:
3 2 1 2 2 1 2 1 3
output:
0 3
result:
ok 2 number(s): "0 3"
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 5952kb
input:
10 10 3 0 3 3 9 7 9 6 0 7 3 3 9 9 4 6 1 9 3 4 2 4 7 10 3 7 5 7 2 7
output:
0 1 0 8 0 1 1 0 0 1
result:
wrong answer 4th numbers differ - expected: '5', found: '8'