QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#432115#8726. Magic Showoceeff0 0ms0kbC++141.2kb2024-06-06 18:57:202024-06-06 18:57:21

Judging History

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

  • [2024-06-06 18:57:21]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-06-06 18:57:20]
  • 提交

Alice

#include "Alice.h"
#include<bits/stdc++.h>
using namespace std;typedef long long ll;typedef pair<int,int> pii;
const int n=5000;const ll inf=1e18;ll k;vector<pii>ans;
vector<pii>Alice(){k=setN(n);for(int i=1;i<n;++i)ans.push_back(make_pair(k%i+1,i+1));return ans;}

Bob

/*
signed main()
{
	n=read();
	for(int i=1;i<=n;++i)a[i]=read(),b[i]=read();
	ans=b[1],M=a[1];
	for(int i=2;i<=n;++i)
B=((b[i]-ans)%a[i]+a[i])%a[i],g=exgcd(M,a[i],x,y),x=mul(x,B/g,a[i]);
ans+=M*x,M*=a[i]/g,(ans+=M)%=M;
	write(ans);
*/
#include "Bob.h"
#include<bits/stdc++.h>
using namespace std;typedef long long ll;typedef __int128 lll;typedef pair<int,int> pii;lll exgcd(lll a,lll b,lll&x,lll&y)
{if(!b)return x=1,y=0,a;lll ans=exgcd(b,a%b,x,y);lll tmp=x;x=y,y=tmp-a/b*y;return ans;}
const int n=5000;const lll inf=1e18,I=1;lll k,x,y,xx,yy,g,z;vector<pii>ans;lll mul(lll x,lll y,lll m){lll ans=0;while(y){if(y&I)ans=(ans+x)%m;y>>=I,x=(x<<I)%m;}return ans;}
ll Bob(vector<pii>V){lll a=0,b=0;/*srand(time(0)),random_shuffle(V.begin(),V.end());*/for(auto i:V){x=i.second-1,y=i.first-1;if(!a)a=x,b=y;else{g=exgcd(a,x,xx,yy);
/*if(a/g*x>8*inf)continue;*/xx=mul(((y-b%x+x)%x)/g,xx,x),a*=x/g,b=(b+mul(a/(x/g),xx,a))%a;if(a>inf)break;}}return (ll)b;}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 0
Time Limit Exceeded

input:

1
4005

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
1 4
2 5
1 6
4 7
2 8
6 9
1 10
6 11
2 12
10 13
2 14
2 15
1 16
6 17
11 18
10 19
16 20
6 21
16 22
2 23
4 24
22 25
6 26
2 27
10 28
2 29
4 30
16 31
7 32
6 33
13 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
1 4
2 5
1 6
4 7
2 8
6 9
1 10
6 11
2 12
10 13
2 14
2 15
1 16
6 17
11 18
10 19
16 20
6 21
16 22
2 23
4 24
22 25
6 26
2 27
10 28
2 29
4 30
16 31
7 32
6 33
13 3...

output:

2
5000 2717
1 2
1 4
1 6
1 46
1 90
1 268
1 446
1 1336
1 4006
2 3
2 8
2 12
2 14
2 23
2 27
2 29
2 45
2 92
2 144
2 155
2 287
2 1002
2 2003
4 24
4 30
4 47
4 59
4 668
4 4003
5 4002
6 9
6 21
6 26
6 33
6 51
6 101
6 161
6 201
6 401
6 501
6 801
6 2001
6 4001
7 32
7 44
7 94
7 4000
8 2000
9 3998
10 19
10 28
10 ...

input:

2
5000 2717
1 2
1 4
1 6
1 46
1 90
1 268
1 446
1 1336
1 4006
2 3
2 8
2 12
2 14
2 23
2 27
2 29
2 45
2 92
2 144
2 155
2 287
2 1002
2 2003
4 24
4 30
4 47
4 59
4 668
4 4003
5 4002
6 9
6 21
6 26
6 33
6 51
6 101
6 161
6 201
6 401
6 501
6 801
6 2001
6 4001
7 32
7 44
7 94
7 4000
8 2000
9 3998
10 19
10 28
10 ...

output:


Subtask #2:

score: 0
Time Limit Exceeded

Test #13:

score: 0
Time Limit Exceeded

input:

1
17476204

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
2 4
1 5
5 6
5 7
5 8
5 9
5 10
5 11
10 12
5 13
6 14
5 15
5 16
13 17
1 18
5 19
5 20
5 21
5 22
21 23
23 24
5 25
5 26
19 27
23 28
5 29
22 30
5 31
17 32
13 33
32 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
2 4
1 5
5 6
5 7
5 8
5 9
5 10
5 11
10 12
5 13
6 14
5 15
5 16
13 17
1 18
5 19
5 20
5 21
5 22
21 23
23 24
5 25
5 26
19 27
23 28
5 29
22 30
5 31
17 32
13 33
32 ...

output:

2
5000 2999
1 3
1 5
1 35
1 69
2 108
2 322
4 1188
5 6
5 7
5 11
5 13
5 15
5 16
5 20
5 25
5 26
5 29
5 31
5 36
5 39
5 46
5 51
5 57
5 64
5 73
5 76
5 91
5 96
5 101
5 115
5 134
5 141
5 151
5 153
5 176
5 191
5 211
5 253
5 267
5 281
5 286
5 293
5 301
5 343
5 381
5 400
5 421
5 439
5 476
5 505
5 512
5 526
5 53...

input:

2
5000 2999
1 3
1 5
1 35
1 69
2 108
2 322
4 1188
5 6
5 7
5 11
5 13
5 15
5 16
5 20
5 25
5 26
5 29
5 31
5 36
5 39
5 46
5 51
5 57
5 64
5 73
5 76
5 91
5 96
5 101
5 115
5 134
5 141
5 151
5 153
5 176
5 191
5 211
5 253
5 267
5 281
5 286
5 293
5 301
5 343
5 381
5 400
5 421
5 439
5 476
5 505
5 512
5 526
5 53...

output:


Subtask #3:

score: 0
Time Limit Exceeded

Test #25:

score: 0
Time Limit Exceeded

input:

1
355365355024496523

output:

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

input:

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

output:

2
5000 2655
1 2
1 4
1 8
1 22
1 380
1 1138
2 3
3 258
4 5
4 7
4 9
4 10
4 11
4 12
4 13
4 16
4 41
4 45
4 67
4 73
4 89
4 91
4 121
4 133
4 166
4 221
4 331
4 361
4 496
4 661
4 793
4 1133
4 1416
4 2265
4 2831
4 4246
6 14
6 27
6 54
6 107
6 690
8 15
8 29
10 70
10 75
10 112
10 139
10 250
10 499
10 1910
10 2554...

input:

2
5000 2655
1 2
1 4
1 8
1 22
1 380
1 1138
2 3
3 258
4 5
4 7
4 9
4 10
4 11
4 12
4 13
4 16
4 41
4 45
4 67
4 73
4 89
4 91
4 121
4 133
4 166
4 221
4 331
4 361
4 496
4 661
4 793
4 1133
4 1416
4 2265
4 2831
4 4246
6 14
6 27
6 54
6 107
6 690
8 15
8 29
10 70
10 75
10 112
10 139
10 250
10 499
10 1910
10 2554...

output: