QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#415792#8343. 玩游戏marher30 15ms5452kbC++14705b2024-05-21 10:23:412024-05-21 10:23:41

Judging History

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

  • [2024-05-21 10:23:41]
  • 评测
  • 测评结果:30
  • 用时:15ms
  • 内存:5452kb
  • [2024-05-21 10:23:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

int n,mod;

void init(int m)
{
    n=m;mod=2*n+1;
}

std::pair<int, int> encode(vector<int> a)
{
    int sum=0;
    sort(a.begin(),a.end());
    for(auto x:a)sum=(sum+x)%mod;
    static bool vis[450000];
    for(int i=0;i<mod;i++)vis[i]=0;
    for(auto x:a)vis[x]=1;
    if(sum==0)return make_pair(a[1],a[0]);
    for(auto x:a)if(vis[(sum-x+mod)%mod])return make_pair(x,(sum-x+mod)%mod);
    return make_pair(1000000,1000000);
}

int decode(pair<int, int> a, pair<int, int> b)
{
    int sum=0;
    if(a.first<a.second)sum+=a.first+a.second;
    if(b.first<b.second)sum+=b.first+b.second;
    sum%=mod;
    return (mod-sum)%mod;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer on the first run

Test #1:

score: 0
Wrong Answer on the first run

input:

6 16666 16807

output:

6 16666
0 9
4 8
1 1
2 2
0 7
5 12
1 1
4 12
3 8
6 12
8 12
1 3
3 5
7 11
7 7
1 8
6 9
0 7
1 11
5 10
0 10
9 9
2 9
4 8
6 12
0 10
5 11
3 6
1 9
5 7
1 10
0 7
2 7
0 1
1 9
0 6
2 2
1 1
2 7
3 0
6 6
0 3
0 4
8 8
1 4
0 9
4 8
1 2
0 5
1 4
0 3
1 5
1 6
8 11
0 8
5 7
1000000 1000000
7 7
1 1
4 4
2 10
0 6
3 8
1000000 100000...

input:


output:


result:

wrong answer wa on first run: you used an invalid card 1000000 (test case 29)

Subtask #2:

score: 30
Accepted

Test #6:

score: 30
Accepted
time: 10ms
memory: 4632kb

input:

68876 1 470211272

output:

68876 1
1 105479
0 96099

input:

68876 1
1 105479
0 96099

output:

73927

result:

ok passed (1 test case)

Test #7:

score: 30
Accepted
time: 9ms
memory: 4316kb

input:

58538 1 101027544

output:

58538 1
9 44235
0 69295

input:

58538 1
9 44235
0 69295

output:

3538

result:

ok passed (1 test case)

Test #8:

score: 30
Accepted
time: 8ms
memory: 4368kb

input:

50603 1 1457850878

output:

50603 1
9 33815
1 91702

input:

50603 1
9 33815
1 91702

output:

76887

result:

ok passed (1 test case)

Test #9:

score: 30
Accepted
time: 13ms
memory: 4524kb

input:

33045 3 1458777923

output:

33045 3
3 52963
0 57210
4 36402
7 263
4 56769
1 60184

input:

33045 3
3 52963
0 57210
4 36402
7 263
4 56769
1 60184

output:

22006
29415
15224

result:

ok passed (3 test cases)

Test #10:

score: 30
Accepted
time: 11ms
memory: 4124kb

input:

20970 4 2007237709

output:

20970 4
1 4631
0 32005
0 6082
4 2422
3 16888
2 11555
6 11910
2 34814

input:

20970 4
1 4631
0 32005
0 6082
4 2422
3 16888
2 11555
6 11910
2 34814

output:

5304
33433
13493
37150

result:

ok passed (4 test cases)

Test #11:

score: 30
Accepted
time: 9ms
memory: 4332kb

input:

40786 2 823564440

output:

40786 2
10 8858
0 48994
5 55559
7 70517

input:

40786 2
10 8858
0 48994
5 55559
7 70517

output:

23711
37058

result:

ok passed (2 test cases)

Test #12:

score: 30
Accepted
time: 6ms
memory: 4324kb

input:

59198 1 1115438165

output:

59198 1
3 87448
5 86807

input:

59198 1
3 87448
5 86807

output:

62531

result:

ok passed (1 test case)

Test #13:

score: 30
Accepted
time: 10ms
memory: 5164kb

input:

92994 1 1784484492

output:

92994 1
5 149302
1 92895

input:

92994 1
5 149302
1 92895

output:

129775

result:

ok passed (1 test case)

Test #14:

score: 30
Accepted
time: 10ms
memory: 5452kb

input:

95914 1 74243042

output:

95914 1
6 127193
2 108296

input:

95914 1
6 127193
2 108296

output:

148161

result:

ok passed (1 test case)

Test #15:

score: 30
Accepted
time: 9ms
memory: 4372kb

input:

56585 1 114807987

output:

56585 1
2 97483
5 104808

input:

56585 1
2 97483
5 104808

output:

24044

result:

ok passed (1 test case)

Test #16:

score: 30
Accepted
time: 14ms
memory: 4812kb

input:

49131 2 1137522503

output:

49131 2
3 35122
1 50124
1 58618
3 65612

input:

49131 2
3 35122
1 50124
1 58618
3 65612

output:

13013
72292

result:

ok passed (2 test cases)

Test #17:

score: 30
Accepted
time: 9ms
memory: 4300kb

input:

58330 1 1441282327

output:

58330 1
2 115844
1 104373

input:

58330 1
2 115844
1 104373

output:

13102

result:

ok passed (1 test case)

Test #18:

score: 30
Accepted
time: 15ms
memory: 5420kb

input:

95899 1 16531729

output:

95899 1
16 90655
0 19169

input:

95899 1
16 90655
0 19169

output:

81959

result:

ok passed (1 test case)

Test #19:

score: 30
Accepted
time: 6ms
memory: 4372kb

input:

59202 1 823378840

output:

59202 1
0 64228
6 110904

input:

59202 1
0 64228
6 110904

output:

61672

result:

ok passed (1 test case)

Test #20:

score: 30
Accepted
time: 14ms
memory: 5100kb

input:

91350 1 143542612

output:

91350 1
0 175208
1 88382

input:

91350 1
0 175208
1 88382

output:

101811

result:

ok passed (1 test case)

Test #21:

score: 30
Accepted
time: 10ms
memory: 4324kb

input:

37397 2 896544303

output:

37397 2
4 32580
5 6305
2 19350
1 70127

input:

37397 2
4 32580
5 6305
2 19350
1 70127

output:

35901
60110

result:

ok passed (2 test cases)

Test #22:

score: 30
Accepted
time: 4ms
memory: 4292kb

input:

51165 1 1474833169

output:

51165 1
2 60144
0 15037

input:

51165 1
2 60144
0 15037

output:

27148

result:

ok passed (1 test case)

Test #23:

score: 30
Accepted
time: 9ms
memory: 4708kb

input:

61423 1 1264817709

output:

61423 1
1 78766
4 107829

input:

61423 1
1 78766
4 107829

output:

59094

result:

ok passed (1 test case)

Test #24:

score: 30
Accepted
time: 11ms
memory: 4076kb

input:

15177 6 1998097157

output:

15177 6
3 5730
5 14866
3 4426
7 12737
2 17470
4 5869
0 3233
1 20376
3 6534
2 26689
5 28223
1 12089

input:

15177 6
3 5730
5 14866
3 4426
7 12737
2 17470
4 5869
0 3233
1 20376
3 6534
2 26689
5 28223
1 12089

output:

9751
13182
7010
6745
27482
20392

result:

ok passed (6 test cases)

Test #25:

score: 30
Accepted
time: 14ms
memory: 5096kb

input:

91469 1 1817129560

output:

91469 1
9 11798
1 169671

input:

91469 1
9 11798
1 169671

output:

1460

result:

ok passed (1 test case)

Test #26:

score: 30
Accepted
time: 11ms
memory: 4104kb

input:

7001 14 1131570933

output:

7001 14
7 6833
1 1166
0 13437
4 11676
0 4697
4 6333
0 2560
3 11644
1 13163
3 7420
10 5648
2 311
4 2315
1 7490
5 537
0 13652
2 10881
3 2282
1 1712
0 2771
11 693
0 12828
2 4364
0 5592
0 11168
9 13481
2 1810
4 6317

input:

7001 14
7 6833
1 1166
0 13437
4 11676
0 4697
4 6333
0 2560
3 11644
1 13163
3 7420
10 5648
2 311
4 2315
1 7490
5 537
0 13652
2 10881
3 2282
1 1712
0 2771
11 693
0 12828
2 4364
0 5592
0 11168
9 13481
2 1810
4 6317

output:

5996
2889
2969
13799
7419
8032
4193
13812
835
9519
471
4045
3348
5870

result:

ok passed (14 test cases)

Test #27:

score: 30
Accepted
time: 12ms
memory: 4040kb

input:

13730 7 197493099

output:

13730 7
3 16982
2 2122
3 8640
0 2572
4 21957
1 2052
0 22701
7 14502
3 18966
4 1578
2 23013
3 1662
0 14084
2 6843

input:

13730 7
3 16982
2 2122
3 8640
0 2572
4 21957
1 2052
0 22701
7 14502
3 18966
4 1578
2 23013
3 1662
0 14084
2 6843

output:

8352
16246
3447
17712
6910
2781
6532

result:

ok passed (7 test cases)

Test #28:

score: 30
Accepted
time: 11ms
memory: 3840kb

input:

5908 16 1404280278

output:

5908 16
2 11347
13 1019
4 8187
1 32
5 6330
0 9311
2 7161
1 1001
0 14
10 1159
5 1872
19 6324
0 1371
3 7576
1 83
0 795
3 6359
0 4390
0 2366
2 11603
4 8079
2 8539
2 6871
0 4730
1 11686
4 11133
1 11789
7 7852
4 6680
0 4754
0 448
2 9929

input:

5908 16
2 11347
13 1019
4 8187
1 32
5 6330
0 9311
2 7161
1 1001
0 14
10 1159
5 1872
19 6324
0 1371
3 7576
1 83
0 795
3 6359
0 4390
0 2366
2 11603
4 8079
2 8539
2 6871
0 4730
1 11686
4 11133
1 11789
7 7852
4 6680
0 4754
0 448
2 9929

output:

11253
3593
7988
3652
10634
3597
2867
10938
1065
9663
7010
214
810
3985
379
1438

result:

ok passed (16 test cases)

Test #29:

score: 30
Accepted
time: 8ms
memory: 4316kb

input:

53685 1 893351816

output:

53685 1
0 76996
2 54630

input:

53685 1
0 76996
2 54630

output:

83114

result:

ok passed (1 test case)

Test #30:

score: 30
Accepted
time: 12ms
memory: 4368kb

input:

29258 3 1505795335

output:

29258 3
1 23305
5 54065
1 257
2 15929
2 30963
10 27849

input:

29258 3
1 23305
5 54065
1 257
2 15929
2 30963
10 27849

output:

39658
42328
58210

result:

ok passed (3 test cases)

Subtask #3:

score: 0
Wrong Answer

Test #31:

score: 0
Wrong Answer
time: 7ms
memory: 4696kb

input:

18 5555 1954899097

output:

18 5555
0 20
3 13
0 9
1 30
10 36
2 12
3 9
1 24
1 14
2 15
13 35
7 11
0 34
1 19
0 24
5 29
1 18
15 35
0 35
1 30
5 28
0 26
6 19
4 31
0 14
10 12
5 2
0 23
3 28
1 31
18 36
1 8
0 34
7 16
0 19
5 35
4 17
5 15
0 13
8 20
1 35
11 34
3 14
2 17
0 33
11 22
2 11
1 18
2 22
1 30
0 17
2 31
0 9
2 8
4 32
1 34
0 36
6 17
4...

input:

18 5555
0 20
3 13
0 9
1 30
10 36
2 12
3 9
1 24
1 14
2 15
13 35
7 11
0 34
1 19
0 24
5 29
1 18
15 35
0 35
1 30
5 28
0 26
6 19
4 31
0 14
10 12
5 2
0 23
3 28
1 31
18 36
1 8
0 34
7 16
0 19
5 35
4 17
5 15
0 13
8 20
1 35
11 34
3 14
2 17
0 33
11 22
2 11
1 18
2 22
1 30
0 17
2 31
0 9
2 8
4 32
1 34
0 36
6 17
4...

output:

1
34
14
0
5
8
20
16
5
8
15
14
1
14
11
11
17
15
33
33
30
1
8
5
19
24
18
3
15
7
11
9
9
15
19
5
7
2
34
7
6
19
6
3
10
7
1
19
32
10
25
24
3
13
7
17
9
36
15
3
5
16
16
17
33
0
28
36
15
21
11
15
30
19
6
0
2
1
3
0
10
34
24
10
33
2
2
4
2
12
35
14
33
29
36
35
11
14
23
21
12
10
29
7
2
30
33
24
25
9
18
36
31
28
...

result:

wrong answer wrong answer: read 10 but expected 4 (test case 50)