QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#422651#1963. Squid GameBronyaAC ✓0ms3952kbC++20749b2024-05-27 17:58:052024-05-27 17:58:05

Judging History

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

  • [2024-05-27 17:58:05]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3952kb
  • [2024-05-27 17:58:05]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
int id[5];
long long a[5];
vector<pair<int,int> >ans;
void add(int u,int v){
	a[u]-=a[v];
	a[v]+=a[v];
	ans.push_back({id[u],id[v]});
}
void Solve(){
	if(!(a[1]&&a[2]&&a[3]))return;
	if(a[1]>a[2])swap(a[1],a[2]),swap(id[1],id[2]);
	if(a[2]>a[3])swap(a[2],a[3]),swap(id[2],id[3]);
	if(a[1]>a[2])swap(a[1],a[2]),swap(id[1],id[2]);
	long long x=a[2]/a[1];
	if(a[2]%a[1]>a[1]-a[2]%a[1])x++;
	while(x){
		if(!(x&1))add(3,1);
		else if(a[2]>=a[1])add(2,1);
		else add(1,2);
		x>>=1;
	}
	Solve();
}
int main(){
	scanf("%lld%lld%lld",&a[1],&a[2],&a[3]);
	id[1]=1;id[2]=2;id[3]=3;
	Solve();
	printf("%d\n",(int)ans.size());
	for(auto [x,y]:ans)printf("%d %d\n",x,y);
	return 0;
}

详细

Test #1:

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

input:

1 2 3

output:

2
3 1
2 1

result:

ok good plan

Test #2:

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

input:

1 4 6

output:

3
3 1
3 1
2 1

result:

ok good plan

Test #3:

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

input:

3 4 8

output:

4
2 1
3 2
1 2
1 2

result:

ok good plan

Test #4:

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

input:

2 5 8

output:

5
3 1
2 1
1 2
3 2
3 2

result:

ok good plan

Test #5:

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

input:

3 8 12

output:

6
2 1
1 2
3 1
2 1
3 1
2 1

result:

ok good plan

Test #6:

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

input:

5 9 13

output:

6
3 1
1 2
2 1
2 1
2 1
3 1

result:

ok good plan

Test #7:

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

input:

4 15 26

output:

7
3 1
3 1
1 2
2 1
3 1
3 1
3 1

result:

ok good plan

Test #8:

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

input:

8 27 46

output:

12
2 1
2 1
1 2
1 2
3 2
2 1
1 2
3 2
1 2
1 2
1 2
3 2

result:

ok good plan

Test #9:

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

input:

27 35 43

output:

14
2 1
3 2
1 2
3 2
1 3
2 3
1 3
3 1
2 3
1 3
1 3
1 3
2 3
1 3

result:

ok good plan

Test #10:

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

input:

8 35 62

output:

13
3 1
3 1
2 1
3 2
1 2
3 2
2 3
1 2
3 2
3 2
3 2
1 2
3 2

result:

ok good plan

Test #11:

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

input:

66 95 98

output:

26
2 1
3 2
3 2
2 3
2 3
1 3
3 2
2 3
1 3
2 3
2 3
3 1
1 3
2 3
1 3
1 3
2 3
2 3
1 2
1 2
1 2
1 2
1 2
1 2
1 2
3 2

result:

ok good plan

Test #12:

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

input:

109 167 289

output:

36
3 1
1 2
2 1
2 1
1 3
3 1
3 1
3 1
1 2
3 1
2 1
2 1
2 1
3 1
1 3
2 3
1 3
2 3
1 3
3 2
1 3
1 3
2 3
1 3
1 3
1 3
1 3
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
3 1

result:

ok good plan

Test #13:

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

input:

269 380 398

output:

43
2 1
1 2
1 2
2 3
3 2
3 2
1 2
3 1
2 1
3 1
3 1
1 2
2 1
3 1
3 1
2 1
2 1
3 1
1 3
1 3
1 3
1 3
2 3
1 3
2 3
3 2
1 2
3 2
1 2
3 2
3 2
1 2
1 2
3 1
3 1
3 1
3 1
3 1
3 1
3 1
3 1
3 1
2 1

result:

ok good plan

Test #14:

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

input:

233 364 480

output:

44
3 1
1 2
2 1
3 1
1 3
2 3
2 3
1 3
3 1
2 1
3 1
3 1
1 2
3 1
2 1
2 1
3 1
2 1
3 1
1 3
2 3
2 3
1 3
2 3
1 3
2 3
1 2
3 2
3 2
1 2
1 2
3 2
1 2
1 2
3 1
3 1
3 1
3 1
3 1
3 1
3 1
3 1
3 1
2 1

result:

ok good plan

Test #15:

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

input:

1098 1376 1489

output:

59
2 1
3 2
1 2
3 2
1 3
2 3
2 3
2 3
3 1
2 3
2 3
1 3
1 3
2 3
1 2
3 2
1 2
1 2
1 2
1 2
2 3
3 2
3 2
3 2
3 2
3 2
3 2
3 2
1 2
2 1
2 1
2 1
3 1
3 1
2 1
2 1
2 1
1 3
3 1
2 1
2 1
2 1
2 1
2 1
3 1
2 1
3 1
2 1
1 2
3 2
1 2
3 2
3 2
3 2
3 2
1 2
3 2
3 2
3 2

result:

ok good plan

Test #16:

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

input:

10035 10338 10444

output:

81
2 1
1 2
3 2
1 2
1 2
1 2
3 2
1 3
1 3
1 3
1 3
2 3
2 3
1 3
2 1
3 1
3 1
3 1
3 1
3 1
2 1
2 1
1 2
1 2
1 2
3 2
1 2
1 2
3 2
3 2
3 2
1 3
2 3
1 3
2 3
1 3
2 3
1 3
1 3
1 3
2 3
1 3
3 1
2 1
3 1
3 1
2 1
3 1
3 1
3 1
3 1
3 1
3 1
2 1
3 2
3 2
3 2
3 2
1 2
3 2
1 2
1 2
1 2
1 2
3 2
1 2
3 2
2 3
2 3
2 3
2 3
2 3
1 3
1 3
2...

result:

ok good plan

Test #17:

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

input:

100010 100200 100227

output:

109
2 1
1 2
1 2
1 2
1 2
3 2
1 2
1 2
1 2
1 2
2 3
1 2
1 2
3 2
3 2
1 2
1 2
1 2
3 2
3 2
3 2
1 2
3 1
2 1
3 1
3 1
3 1
3 1
3 1
3 1
3 1
2 1
2 1
1 3
3 1
3 1
3 1
3 1
3 1
2 1
3 1
3 1
2 1
2 1
2 1
3 1
2 1
3 2
3 2
3 2
1 2
1 2
3 2
1 2
1 2
1 2
3 2
1 2
1 2
3 2
3 2
2 3
1 3
1 3
2 3
1 3
1 3
2 3
1 3
2 3
1 3
2 3
1 3
2 3
...

result:

ok good plan

Test #18:

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

input:

1000000 1000235 1000288

output:

133
2 1
3 2
1 2
1 2
1 2
1 2
3 2
1 2
3 2
1 2
1 2
1 2
1 2
2 3
1 2
1 2
3 2
3 2
3 2
3 2
1 2
3 2
1 2
1 2
1 2
3 2
3 2
1 2
2 1
2 1
2 1
2 1
3 1
3 1
3 1
3 1
3 1
3 1
2 1
3 1
3 1
2 1
1 3
2 1
3 1
3 1
3 1
3 1
2 1
2 1
2 1
2 1
3 1
2 1
2 1
2 1
2 1
3 1
2 1
3 2
3 2
3 2
3 2
1 2
3 2
3 2
1 2
1 2
1 2
3 2
3 2
1 2
1 2
3 2
...

result:

ok good plan

Test #19:

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

input:

10000011 10000314 10000358

output:

160
2 1
1 2
1 2
3 2
3 2
1 2
3 2
3 2
3 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
3 2
1 3
2 3
2 3
2 3
2 3
1 3
1 3
2 3
1 3
1 3
1 3
1 3
2 3
2 3
2 3
2 3
1 3
2 1
2 1
2 1
3 1
2 1
2 1
3 1
2 1
2 1
3 1
2 1
3 1
2 1
3 1
2 1
3 1
3 1
2 1
1 2
1 2
1 2
3 2
1 2
1 2
1 2
1 2
3 2
3 2
3 2
1 2
3 2
3 2
3 2
3 2
1 2
1 2
2 3
3 2
3 2
1 2
...

result:

ok good plan

Test #20:

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

input:

100000057 100000244 100000402

output:

190
2 1
1 2
3 2
1 2
3 2
1 2
3 2
3 2
3 2
1 2
1 2
1 2
3 2
1 2
3 2
1 2
1 2
1 2
1 2
1 2
2 3
3 2
1 2
1 2
1 2
1 2
1 2
3 2
3 2
3 2
3 2
1 2
1 2
1 2
1 2
3 2
3 2
1 2
3 2
3 2
3 2
2 1
3 2
1 2
3 2
1 2
1 2
3 2
1 2
3 2
3 2
1 2
3 2
3 2
1 2
1 2
3 2
1 2
1 2
1 2
3 2
1 2
1 2
2 3
3 2
1 2
3 2
3 2
3 2
1 2
3 2
3 2
1 2
1 2
...

result:

ok good plan

Test #21:

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

input:

1 1000000 1000000000

output:

20
3 1
3 1
3 1
3 1
3 1
3 1
2 1
3 1
3 1
2 1
3 1
3 1
3 1
3 1
2 1
3 1
2 1
2 1
2 1
2 1

result:

ok good plan

Test #22:

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

input:

1024 65536 536870912

output:

7
3 1
3 1
3 1
3 1
3 1
3 1
2 1

result:

ok good plan

Test #23:

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

input:

6 268435456 536870912

output:

54
2 1
2 1
3 1
2 1
3 1
2 1
3 1
2 1
3 1
2 1
3 1
2 1
3 1
2 1
3 1
2 1
3 1
2 1
3 1
2 1
3 1
2 1
3 1
2 1
3 1
1 2
3 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
3 1
2 1

result:

ok good plan

Test #24:

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

input:

7 16777217 536870909

output:

46
2 1
3 1
3 1
2 1
3 1
3 1
2 1
3 1
3 1
2 1
3 1
3 1
2 1
3 1
3 1
2 1
3 1
3 1
2 1
3 1
3 1
2 1
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
1 2
1 2
1 2

result:

ok good plan

Test #25:

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

input:

24223 44594 72242

output:

115
3 1
1 2
2 1
2 1
3 1
3 1
2 3
1 3
2 3
2 3
2 3
1 3
3 1
2 1
3 1
2 1
3 1
2 1
1 2
1 2
3 2
3 2
3 2
3 2
3 2
1 2
3 1
3 1
3 1
2 1
2 1
2 1
3 1
3 1
1 3
2 1
3 1
3 1
2 1
3 1
3 1
2 1
2 1
2 1
2 1
3 2
3 2
3 2
3 2
1 2
3 2
1 2
1 2
1 2
3 2
1 2
2 3
1 2
3 2
3 2
1 2
3 2
1 2
3 2
3 2
1 2
3 2
3 2
2 1
3 2
3 2
3 2
1 2
1 2
...

result:

ok good plan

Test #26:

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

input:

123441 146831 150393

output:

139
2 1
1 2
3 2
3 2
2 3
2 3
1 3
1 3
3 2
2 3
1 3
2 3
1 3
1 3
3 1
2 1
3 1
2 1
2 1
2 1
3 1
1 3
2 3
2 3
2 3
2 3
2 3
1 3
1 3
2 3
1 2
3 2
1 2
3 2
3 2
1 2
3 2
1 2
1 2
2 1
3 1
2 1
3 1
3 1
3 1
2 1
3 1
3 1
3 1
1 2
3 1
3 1
2 1
2 1
2 1
3 1
2 1
3 1
2 1
3 1
2 1
1 3
2 1
3 1
2 1
2 1
2 1
3 1
3 1
3 1
3 1
3 1
3 1
2 1
...

result:

ok good plan

Test #27:

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

input:

1017604 1044219 1047264

output:

175
2 1
3 2
3 2
3 2
1 2
1 2
3 2
2 3
1 3
1 3
2 3
1 3
2 3
2 3
1 3
2 1
2 1
2 1
2 1
2 1
3 1
3 1
1 2
3 1
2 1
2 1
3 1
3 1
3 1
2 1
3 1
3 1
1 2
3 1
3 1
2 1
3 1
3 1
2 1
3 1
3 1
2 1
2 1
3 1
1 3
1 3
1 3
2 3
2 3
1 3
1 3
2 3
2 3
1 3
2 3
3 2
2 3
2 3
2 3
1 3
2 3
1 3
1 3
1 3
1 3
2 3
1 3
2 3
2 3
3 1
2 3
1 3
2 3
2 3
...

result:

ok good plan

Test #28:

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

input:

10023437 10049857 10053253

output:

213
2 1
3 2
1 2
3 2
3 2
3 2
3 2
3 2
1 2
2 3
1 2
3 2
1 2
1 2
1 2
3 2
1 2
1 2
1 2
1 2
2 3
1 2
1 2
3 2
1 2
1 2
3 2
3 2
1 2
3 2
2 1
3 2
1 2
3 2
1 2
1 2
3 2
3 2
3 2
3 2
3 2
3 2
1 2
2 1
3 1
2 1
2 1
3 1
3 1
2 1
2 1
2 1
3 1
3 1
3 1
3 1
1 2
2 1
3 1
3 1
3 1
2 1
2 1
2 1
3 1
2 1
3 1
2 1
3 1
3 1
1 3
3 1
2 1
3 1
...

result:

ok good plan

Test #29:

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

input:

100010076 100034479 100039408

output:

264
2 1
3 2
3 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
3 2
2 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
2 3
2 3
2 3
2 3
3 1
2 3
2 3
1 3
1 3
1 3
2 3
1 3
1 3
2 3
1 3
2 3
2 3
1 3
1 3
2 3
1 2
1 2
3 2
3 2
1 2
3 2
3 2
1 2
3 2
1 2
1 2
3 2
1 2
1 2
1 2
1 2
2 1
2 1
2 1
3 1
3 1
3 1
3 1
3 1
3 1
3 1
2 1
3 1
2 1
3 1
2 1
...

result:

ok good plan

Test #30:

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

input:

100021199 100049225 100065369

output:

263
2 1
1 2
3 2
1 2
1 2
3 2
3 2
3 2
3 2
3 2
1 2
3 2
3 2
1 3
1 3
2 3
2 3
2 3
2 3
1 3
2 3
2 3
2 3
1 3
1 3
1 3
3 2
2 3
1 3
2 3
2 3
1 3
2 3
1 3
2 3
2 3
1 3
2 3
2 3
2 3
1 3
3 1
1 3
1 3
1 3
2 3
2 3
2 3
2 3
2 3
1 3
2 3
1 3
1 3
2 3
2 3
2 3
2 3
1 3
3 1
2 1
3 1
2 1
2 1
2 1
3 1
3 1
3 1
2 1
2 1
2 1
3 1
3 1
2 1
...

result:

ok good plan