QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#664699#7155. Padel Prize PursuitNewtonabc#12 79ms8376kbC++141005b2024-10-21 21:49:202024-10-21 21:49:21

Judging History

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

  • [2024-10-21 21:49:21]
  • 评测
  • 测评结果:12
  • 用时:79ms
  • 内存:8376kb
  • [2024-10-21 21:49:20]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
const int MIDX=2e5;
int a[N],b[N];
struct fenwick{
    long long fw[N];
    void init(){
        for(int i=0;i<N;i++) fw[i]=0;
    }
    void update(int idx,int val){
        idx++;
        while(idx<=MIDX){
            fw[idx]+=val;
            idx+=idx & -idx;
        }
    }
    int read(int idx){
        idx++;
        int sum=0;
        while(idx>0){
            sum+=fw[idx];
            idx-=idx & -idx;
        }
        return sum;
    }
}fa,fb;

int main(){
    int n,m;
    cin>>n >>m;
    fa.init(),fb.init();
    for(int i=0;i<m;i++){
        cin>>a[i] >>b[i];
        if(a[i]==0){
            fa.update(0,1);
            fa.update(i+1,-1);
        }
        else{
            fb.update(0,1);
            fb.update(i+1,-1);
        }
    }
    int a=0,b=0;
    for(int i=0;i<m;i++){
        if(fb.read(i)>fa.read(i)) b++;
        else a++;
    }
    cout<<a <<" " <<b;
    
}

详细

Subtask #1:

score: 12
Accepted

Test #1:

score: 12
Accepted
time: 40ms
memory: 8264kb

input:

2 200000
0 1
1 0
1 0
1 0
0 1
1 0
0 1
1 0
1 0
0 1
0 1
1 0
0 1
0 1
1 0
0 1
1 0
0 1
0 1
0 1
1 0
0 1
0 1
1 0
1 0
0 1
1 0
1 0
1 0
1 0
0 1
1 0
0 1
0 1
0 1
0 1
0 1
0 1
1 0
0 1
1 0
0 1
1 0
0 1
0 1
1 0
1 0
1 0
0 1
1 0
1 0
1 0
0 1
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
1 0
0 1
0 1
1 0
1 0
0 1
0 1
0 1
1 0
0 1...

output:

114418 85582

result:

ok single line: '114418 85582'

Test #2:

score: 12
Accepted
time: 41ms
memory: 8264kb

input:

2 200000
1 0
0 1
1 0
1 0
1 0
1 0
1 0
0 1
0 1
1 0
1 0
1 0
1 0
1 0
1 0
0 1
1 0
1 0
1 0
1 0
0 1
0 1
1 0
0 1
1 0
0 1
0 1
1 0
1 0
1 0
1 0
0 1
0 1
0 1
1 0
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
0 1
1 0
1 0
1 0
0 1
1 0
1 0
0 1
0 1
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
0 1
1 0
1 0
1 0...

output:

78408 121592

result:

ok single line: '78408 121592'

Test #3:

score: 12
Accepted
time: 1ms
memory: 6772kb

input:

2 1
1 0

output:

0 1

result:

ok single line: '0 1'

Test #4:

score: 12
Accepted
time: 43ms
memory: 8376kb

input:

2 200000
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1...

output:

200000 0

result:

ok single line: '200000 0'

Subtask #2:

score: 0
Wrong Answer

Test #5:

score: 0
Wrong Answer
time: 2ms
memory: 8184kb

input:

2000 2000
741 1153
839 1048
1159 445
196 1042
404 1319
638 766
1373 621
736 705
1579 1696
454 1566
1794 474
993 858
424 380
1971 210
1729 861
1450 1275
986 535
964 431
1371 1176
658 378
708 1669
1049 1236
832 533
16 450
675 1324
1680 1598
1936 885
579 307
987 1497
996 1589
1087 843
1303 222
105 1692...

output:

0 2000

result:

wrong answer 1st lines differ - expected: '0 2 0 4 1 0 5 0 2 2 1 0 0 1 0 ...2 0 2 4 0 1 3 2 1 0 2 1 2 2 3 0', found: '0 2000'

Subtask #3:

score: 0
Wrong Answer

Test #21:

score: 15
Accepted
time: 44ms
memory: 8240kb

input:

2 200000
0 1
1 0
1 0
1 0
0 1
1 0
0 1
1 0
1 0
0 1
0 1
1 0
0 1
0 1
1 0
0 1
1 0
0 1
0 1
0 1
1 0
0 1
0 1
1 0
1 0
0 1
1 0
1 0
1 0
1 0
0 1
1 0
0 1
0 1
0 1
0 1
0 1
0 1
1 0
0 1
1 0
0 1
1 0
0 1
0 1
1 0
1 0
1 0
0 1
1 0
1 0
1 0
0 1
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
1 0
0 1
0 1
1 0
1 0
0 1
0 1
0 1
1 0
0 1...

output:

114418 85582

result:

ok single line: '114418 85582'

Test #22:

score: 15
Accepted
time: 45ms
memory: 8312kb

input:

2 200000
1 0
0 1
1 0
1 0
1 0
1 0
1 0
0 1
0 1
1 0
1 0
1 0
1 0
1 0
1 0
0 1
1 0
1 0
1 0
1 0
0 1
0 1
1 0
0 1
1 0
0 1
0 1
1 0
1 0
1 0
1 0
0 1
0 1
0 1
1 0
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
0 1
1 0
1 0
1 0
0 1
1 0
1 0
0 1
0 1
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
0 1
1 0
1 0
1 0...

output:

78408 121592

result:

ok single line: '78408 121592'

Test #23:

score: 15
Accepted
time: 0ms
memory: 6832kb

input:

2 1
1 0

output:

0 1

result:

ok single line: '0 1'

Test #24:

score: 15
Accepted
time: 43ms
memory: 8324kb

input:

2 200000
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1...

output:

200000 0

result:

ok single line: '200000 0'

Test #25:

score: 0
Wrong Answer
time: 76ms
memory: 8328kb

input:

200000 200000
127497 49844
33921 127497
33921 39859
33921 138631
166524 33921
190508 166524
190508 50999
190508 91282
190508 39858
192631 190508
192631 21222
192631 178212
192631 129337
192631 59888
192631 33496
192631 37457
156089 192631
156089 154380
64450 156089
55350 64450
47341 55350
47341 8049...

output:

0 200000

result:

wrong answer 1st lines differ - expected: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0', found: '0 200000'

Subtask #4:

score: 0
Wrong Answer

Test #31:

score: 0
Wrong Answer
time: 73ms
memory: 8236kb

input:

200000 200000
33870 101688
1598 78943
23260 47952
84769 196360
104405 172552
58448 113260
76500 80767
95836 53662
58671 55746
167974 83639
176177 32272
45361 115076
152875 160216
33361 176768
162031 181989
134541 80064
21681 167447
96707 196846
16036 34620
166990 179451
45201 65888
89903 93145
13742...

output:

0 200000

result:

wrong answer 1st lines differ - expected: '0 2 0 1 1 0 0 0 1 0 0 1 0 1 1 ...5 0 0 0 0 0 3 0 1 0 2 2 0 0 2 0', found: '0 200000'

Subtask #5:

score: 0
Wrong Answer

Test #45:

score: 0
Wrong Answer
time: 79ms
memory: 8324kb

input:

200000 199999
38963 164177
50862 38963
161216 50862
40786 161216
101295 40786
95756 101295
172936 95756
194407 172936
106240 194407
155843 106240
82989 155843
46308 82989
35380 46308
180666 35380
62373 180666
100648 62373
22679 100648
23941 22679
57908 23941
195841 57908
30559 195841
123952 30559
68...

output:

0 199999

result:

wrong answer 1st lines differ - expected: '99029 0 0 58510 0 17566 0 0 0 ...0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0', found: '0 199999'

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%