QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#92653#4393. Snatch Grocerieszbceyond#WA 381ms23360kbC++20967b2023-03-30 20:14:482023-03-30 20:14:51

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-30 20:14:51]
  • 评测
  • 测评结果:WA
  • 用时:381ms
  • 内存:23360kb
  • [2023-03-30 20:14:48]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x;i<=y;i++)
#define per(i,x,y) for(int i=x;i>=y;i--)
using namespace std;
const int N=6e6+10;
const int mod=998244353;
#define int long long
int qmi(int a,int b,int mod){//mod别弄错了
    int res=1;
    for(;b;b>>=1,a=a*a%mod)
        if(b&1)res=res*a%mod;
    return res;
}
void solve() {
    int n;cin>>n;
    vector<int>l(n+1),r(n+1);
    map<int,int>cnt;
    rep(i,1,n){
        cin>>l[i]>>r[i];
        cnt[l[i]]++,cnt[r[i]]+=0,cnt[r[i]+1]--;
    }
    int now=0;
    for(auto &[x,y]:cnt){
        now+=y;
        y=now;
    }
    int ans=0;
    rep(i,1,n){
        if(cnt[l[i]]==1 and cnt[r[i]]==1)ans++;
        else break;
    }
    cout<<ans<<"\n";
}
signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int tc = 1;
    cin >> tc;
    for (int i = 1; i <= tc; i++) {
        solve();
    }
}
//2
//3
//1 2
//3 4
//5 6
//3
//1 2
//2 3
//1 5

详细

Test #1:

score: 0
Wrong Answer
time: 381ms
memory: 23360kb

input:

5
3
1 2
3 4
5 6
3
1 2
3 4
4 5
100000
263324740 263324748
920719069 920719077
82595123 82595132
765796214 765796222
621714954 621714959
77799324 77799332
278166427 278166428
375391536 375391545
856576804 856576812
512542774 512542781
829984452 829984457
302442403 302442404
779239984 779239986
1189173...

output:

3
1
1580
288
10000

result:

wrong answer 3rd lines differ - expected: '275', found: '1580'