QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#861365#9982. Staircase Museumucup-team4717#WA 5ms12108kbC++14561b2025-01-18 17:08:392025-01-18 17:08:46

Judging History

This is the latest submission verdict.

  • [2025-01-18 17:08:46]
  • Judged
  • Verdict: WA
  • Time: 5ms
  • Memory: 12108kb
  • [2025-01-18 17:08:39]
  • Submitted

answer

#include<bits/stdc++.h>
#define int long long
#define N 500005
using namespace std;
int T;
int n;
int L[N],R[N];
int l[N],r[N];
int f[N][2];
void sol(){
    scanf("%lld",&n);
    for(int i=1;i<=n;i++) scanf("%lld %lld",&L[i],&R[i]);
    int m=0;
    for(int i=1;i<=n;i++) if(L[i]!=L[i-1]||R[i]!=R[i-1]) m++,l[m]=L[i],r[m]=R[i];
    n=m;
    int o=0,ans=0;
    for(int i=1;i<=n;i++){
        if(o+1<=r[i]) o=max(o+1,l[i]),ans++;
    }
    printf("%lld\n",ans);
}
signed main(){
    scanf("%lld",&T);
    while(T--) sol();
    return 0;
}

详细

Test #1:

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

input:

4
3
1 2
1 3
1 3
3
1 2
2 3
3 3
3
1 1
1 3
3 3
4
1 2
2 3
3 4
4 5

output:

2
3
3
4

result:

ok 4 number(s): "2 3 3 4"

Test #2:

score: 0
Accepted
time: 0ms
memory: 12108kb

input:

1
1
1 1000000000

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: -100
Wrong Answer
time: 5ms
memory: 12108kb

input:

9653
1
1 1
2
1 1
1 1
3
1 1
1 1
1 1
4
1 1
1 1
1 1
1 1
5
1 1
1 1
1 1
1 1
1 1
6
1 1
1 1
1 1
1 1
1 1
1 1
6
1 2
1 2
1 2
1 2
1 2
2 2
6
1 1
1 1
1 1
1 1
1 1
1 2
6
1 2
1 2
1 2
1 2
1 2
2 3
5
1 2
1 2
1 2
1 2
2 2
6
1 2
1 2
1 2
1 2
2 2
2 2
6
1 3
1 3
1 3
1 3
2 3
3 3
6
1 2
1 2
1 2
1 2
2 2
2 3
6
1 3
1 3
1 3
1 3
2 3...

output:

1
1
1
1
1
1
2
2
2
2
2
3
3
3
2
2
3
3
3
2
3
2
2
3
3
3
3
3
2
2
2
3
3
3
3
3
4
4
4
3
3
4
4
4
3
4
3
3
4
4
4
4
4
2
2
2
3
3
3
2
3
3
3
3
3
4
4
4
3
4
4
4
3
3
4
4
4
3
4
4
4
3
4
3
3
4
4
4
4
4
4
4
4
4
2
2
3
3
4
3
3
4
4
4
3
4
2
2
2
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
3
3
4
4
4
4
4
4
4
4
4
3
3
4
4
4
4
4
4
4
4
4
3
3
4
...

result:

wrong answer 17th numbers differ - expected: '2', found: '3'