QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#819139#964. Excluded MinlgvcWA 1ms5956kbC++23487b2024-12-18 13:01:172024-12-18 13:01:23

Judging History

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

  • [2024-12-18 13:01:23]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5956kb
  • [2024-12-18 13:01:17]
  • 提交

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);
    }
}

詳細信息

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'