QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#422833#1963. Squid GameoceeffAC ✓0ms3704kbC++141.6kb2024-05-27 19:42:192024-05-27 19:42:22

Judging History

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

  • [2024-05-27 19:42:22]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3704kb
  • [2024-05-27 19:42:19]
  • 提交

answer

#include<bits/stdc++.h>
#ifdef ONLINE_JUDGE
	#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
	char buf[1<<21],*p1=buf,*p2=buf;
#endif
using namespace std;int read(){int num=0,f=1;char c;while(!isdigit(c=getchar()))if(c=='-')f=-1;while(isdigit(c))num=num*10+(c&15),c=getchar();return num*f;}void write(int x,char ch=' '){int F[20],cnt=0;if(!x)putchar('0');if(x<0)putchar('-'),x=-x;while(x)F[cnt++]=x%10+'0',x/=10;while(cnt)putchar(F[--cnt]);putchar(ch);}
namespace Main
{
    vector<pair<int,int>>ans;mt19937 rnd(2133);pair<int,int>a[4];void op(int x,int y){/*printf("#%d %d\n",x,y),*/ans.push_back(make_pair(a[x].second,a[y].second)),a[x].first-=a[y].first,a[y].first<<=1;}bool ck(){return a[0].first&&a[1].first&&a[2].first;}
    void OP(int x,int y){a[x].first>=a[y].first?op(x,y):op(y,x);/*for(int i=0;i<3;++i)printf("%d%c",a[i].first," \n"[i==2]);*/}/*void op1(){if(a[1].first>=a[0].first)op(y,x),ans.push_back(make_pair(2,1));}*/void srt(){sort(a,a+3);}void output(){write((int)ans.size(),'\n');for(auto i:ans)write(i.first),write(i.second,'\n');}
    void calc(){for(int i=rnd()%(a[2].first<=100?2:6);i--&&ck();)OP(1,2);if(!ck())output(),exit(0);srt();int x;for(;(x=a[1].first/a[0].first)>0;)if(x&1)OP(1,0);else OP(2,0);}
    void main(){for(int i=0;i<3;++i)a[i].first=read(),a[i].second=i+1;srt();for(;ck();){if(a[1].first==a[2].first)return OP(1,2),output();if(a[0].first==a[1].first)return OP(0,1),output();calc(),srt();}output();}
};
int main()
{
    const bool base=0,IO=1;int T;if(!base)T=1;else if(IO)T=read();else ios::sync_with_stdio(0),cin>>T;for(;T--;)Main::main();
    return 0;
}//Random Faster!

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 2 3

output:

2
3 2
3 1

result:

ok good plan

Test #2:

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

input:

1 4 6

output:

3
3 2
2 1
3 1

result:

ok good plan

Test #3:

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

input:

3 4 8

output:

5
3 2
3 1
2 3
1 3
1 3

result:

ok good plan

Test #4:

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

input:

2 5 8

output:

5
3 2
3 1
2 3
2 3
1 3

result:

ok good plan

Test #5:

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

input:

3 8 12

output:

5
3 2
3 1
2 3
1 3
1 3

result:

ok good plan

Test #6:

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

input:

5 9 13

output:

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

result:

ok good plan

Test #7:

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

input:

4 15 26

output:

10
3 2
2 1
3 1
1 3
2 3
1 3
3 2
2 1
2 1
3 1

result:

ok good plan

Test #8:

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

input:

8 27 46

output:

18
3 2
2 1
3 1
2 3
1 3
2 3
1 3
3 2
2 1
2 1
2 1
3 1
2 1
1 3
1 3
1 3
1 3
2 3

result:

ok good plan

Test #9:

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

input:

27 35 43

output:

16
3 2
1 3
1 3
2 1
3 1
2 1
3 1
2 1
2 3
2 3
1 3
1 2
1 2
1 2
1 2
3 2

result:

ok good plan

Test #10:

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

input:

8 35 62

output:

16
3 2
3 1
3 1
2 3
1 3
2 3
1 3
2 3
2 1
2 1
3 1
3 2
3 2
3 2
3 2
1 2

result:

ok good plan

Test #11:

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

input:

66 95 98

output:

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

result:

ok good plan

Test #12:

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

input:

109 167 289

output:

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

result:

ok good plan

Test #13:

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

input:

269 380 398

output:

34
3 2
2 3
1 3
1 3
1 3
2 1
2 1
2 1
2 1
3 1
1 2
2 1
2 1
2 3
1 3
1 3
1 3
2 3
2 3
3 2
2 1
3 1
3 1
2 1
3 1
3 1
3 1
3 1
1 3
3 2
1 2
3 2
1 2
3 2

result:

ok good plan

Test #14:

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

input:

233 364 480

output:

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

result:

ok good plan

Test #15:

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

input:

1098 1376 1489

output:

57
3 2
1 3
2 3
2 3
1 3
2 1
3 1
3 1
2 1
3 1
1 2
2 1
1 2
2 3
2 3
2 3
1 3
2 3
1 3
2 3
3 2
3 2
2 1
2 1
3 1
2 1
2 1
2 1
2 1
3 1
1 2
2 1
1 2
1 2
2 1
1 3
1 3
2 3
2 3
1 3
2 3
2 3
2 3
1 3
3 1
1 3
1 3
1 2
1 2
1 2
3 2
3 2
1 2
1 2
1 2
1 2
3 2

result:

ok good plan

Test #16:

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

input:

10035 10338 10444

output:

45
3 2
2 3
1 3
1 3
1 3
1 3
2 3
1 3
3 1
3 1
3 1
3 1
3 1
3 1
2 1
3 1
1 2
2 1
2 1
1 3
2 3
1 3
1 3
2 3
1 3
2 3
2 3
1 3
1 3
2 3
1 3
3 1
3 1
1 2
3 2
1 2
1 2
1 2
3 2
1 2
3 2
3 2
3 2
3 2
1 2

result:

ok good plan

Test #17:

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

input:

100010 100200 100227

output:

29
3 2
2 3
2 3
2 3
1 3
1 3
1 3
1 3
2 3
2 3
1 3
1 3
1 3
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
3 1
3 1
2 1
3 1
3 1

result:

ok good plan

Test #18:

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

input:

1000000 1000235 1000288

output:

73
3 2
1 3
1 3
2 3
2 3
1 3
1 3
2 3
1 3
1 3
2 3
2 3
1 3
2 3
2 3
1 3
2 1
2 1
2 1
2 1
2 1
2 1
3 1
2 1
3 1
3 1
2 1
3 1
3 1
2 1
2 1
1 3
3 1
3 1
1 2
3 2
1 2
1 2
1 2
3 2
1 2
3 2
1 2
1 2
3 2
1 2
3 2
1 2
3 2
3 2
1 2
3 2
2 3
2 3
2 1
2 1
2 1
3 1
2 1
3 1
2 1
2 1
3 1
3 1
2 1
2 1
2 1
3 1
2 1
2 1
3 1
3 1
3 1

result:

ok good plan

Test #19:

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

input:

10000011 10000314 10000358

output:

105
3 2
2 3
2 3
2 3
1 3
2 3
2 3
1 3
1 3
1 3
1 3
1 3
2 3
1 3
1 3
1 3
2 3
1 3
1 3
2 1
2 1
2 1
2 1
3 1
2 1
3 1
3 1
3 1
3 1
3 1
2 1
3 1
2 1
2 1
2 1
2 1
2 1
3 1
1 2
1 2
2 1
1 3
2 3
1 3
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
2 3
2 3
3 1
2 1
2 1
3 1
2 1
2 1
3 1
2 1
2 1
3 1
2 1
2 1
3 1
2 1
2 1
...

result:

ok good plan

Test #20:

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

input:

100000057 100000244 100000402

output:

119
3 2
1 3
1 3
1 3
1 3
2 3
2 3
1 3
2 3
2 3
2 3
2 3
1 3
2 3
1 3
2 3
1 3
1 3
2 3
2 3
1 3
3 1
2 1
3 1
3 1
2 1
3 1
2 1
3 1
2 1
3 1
3 1
2 1
2 1
2 1
3 1
3 1
2 1
3 1
3 1
3 1
2 1
1 3
1 3
3 1
1 2
1 2
1 2
3 2
3 2
1 2
1 2
3 2
3 2
3 2
1 2
3 2
3 2
1 2
1 2
3 2
3 2
1 2
3 2
1 2
1 2
3 2
2 1
1 2
1 2
1 3
1 3
1 3
1 3
...

result:

ok good plan

Test #21:

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

input:

1 1000000 1000000000

output:

22
3 2
3 1
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: 3620kb

input:

1024 65536 536870912

output:

9
3 2
3 1
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: 3640kb

input:

6 268435456 536870912

output:

54
3 2
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
2 1
3 1
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 3
2 3
2 3
2 3
2 3
1 3
1 3

result:

ok good plan

Test #24:

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

input:

7 16777217 536870909

output:

48
3 2
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 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: 3548kb

input:

24223 44594 72242

output:

66
3 2
3 1
2 3
1 3
1 3
1 3
2 3
3 2
3 2
3 1
2 1
2 1
2 1
2 1
3 1
2 1
2 1
1 2
1 3
1 3
1 3
1 3
2 3
1 3
2 3
1 3
3 1
1 3
1 3
3 1
1 2
1 2
3 2
3 2
3 2
3 2
3 2
1 2
3 2
3 2
3 2
2 3
3 1
3 1
2 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
3 2
3 2
3 2
3 2
3 2
3 2
3 2
3 2
1 2

result:

ok good plan

Test #26:

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

input:

123441 146831 150393

output:

77
3 2
2 3
1 3
2 3
2 3
2 3
1 3
2 1
3 1
3 1
3 1
2 1
3 1
2 1
1 3
3 1
1 3
3 2
3 2
1 2
3 2
3 2
1 2
3 2
1 2
2 1
2 1
1 3
2 3
1 3
1 3
2 3
2 3
2 3
2 3
1 3
1 3
1 3
2 3
3 1
1 3
3 1
3 1
1 3
1 2
1 2
1 2
3 2
3 2
1 2
3 2
3 2
1 2
1 2
1 2
1 2
3 2
1 2
1 2
2 1
2 1
2 3
1 3
1 3
1 3
2 3
1 3
1 3
2 3
2 3
1 3
1 3
2 3
1 3
2...

result:

ok good plan

Test #27:

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

input:

1017604 1044219 1047264

output:

153
3 2
2 3
1 3
1 3
1 3
2 3
2 3
1 3
2 3
1 3
2 1
2 1
3 1
2 1
3 1
3 1
3 1
2 1
3 1
2 1
3 1
2 1
1 3
1 3
3 1
3 2
1 2
1 2
3 2
1 2
1 2
1 2
3 2
3 2
1 2
3 2
3 2
3 2
2 1
2 1
3 1
3 1
2 1
2 1
3 1
2 1
3 1
3 1
3 1
2 1
3 1
2 1
1 2
1 2
1 2
1 2
1 3
2 3
1 3
1 3
2 3
1 3
2 3
2 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
2 3
3 2
2 3
...

result:

ok good plan

Test #28:

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

input:

10023437 10049857 10053253

output:

173
3 2
1 3
1 3
1 3
2 3
2 3
2 3
2 3
1 3
1 3
1 3
2 3
1 3
3 1
3 1
2 1
2 1
2 1
2 1
2 1
3 1
3 1
2 1
3 1
3 1
3 1
1 2
2 1
2 1
1 3
1 3
1 3
2 3
1 3
1 3
1 3
2 3
2 3
2 3
3 1
2 1
3 1
3 1
2 1
2 1
3 1
3 1
2 1
2 1
2 1
3 1
2 1
2 1
2 1
1 2
2 1
2 3
2 3
2 3
1 3
2 3
1 3
2 3
1 3
2 3
2 3
1 3
2 3
2 3
2 3
1 3
1 3
3 2
2 3
...

result:

ok good plan

Test #29:

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

input:

100010076 100034479 100039408

output:

154
3 2
2 3
1 3
2 3
2 3
2 3
2 3
1 3
2 3
1 3
1 3
1 3
1 3
2 3
2 3
1 3
3 1
2 1
2 1
2 1
2 1
2 1
3 1
2 1
3 1
3 1
2 1
2 1
3 1
2 1
3 1
3 1
2 1
2 1
1 3
3 1
3 1
3 2
1 2
1 2
3 2
3 2
1 2
1 2
1 2
1 2
1 2
1 2
3 2
3 2
3 2
3 2
3 2
1 2
3 2
1 2
2 1
2 1
2 3
2 3
2 3
2 3
2 3
2 3
1 3
1 3
1 3
2 3
1 3
2 3
2 3
1 3
2 3
2 3
...

result:

ok good plan

Test #30:

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

input:

100021199 100049225 100065369

output:

192
3 2
1 3
1 3
2 3
2 3
1 3
1 3
2 3
2 3
2 3
2 3
2 3
1 3
1 3
2 1
3 1
3 1
2 1
2 1
3 1
2 1
3 1
2 1
2 1
2 1
3 1
3 1
3 1
2 1
1 2
1 2
2 3
1 3
1 3
2 3
2 3
1 3
1 3
2 3
1 3
2 3
1 3
1 3
1 3
3 2
1 2
1 2
3 2
1 2
1 2
1 2
3 2
3 2
3 2
1 2
3 2
1 2
3 2
1 2
2 1
1 2
2 1
1 2
2 3
1 3
2 3
1 3
2 3
1 3
2 3
1 3
1 3
1 3
2 3
...

result:

ok good plan