QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#415732#8674. Riddle of the SphinxmarherAC ✓1ms3704kbC++141.0kb2024-05-21 09:15:402024-05-21 09:15:41

Judging History

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

  • [2024-05-21 09:15:41]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3704kb
  • [2024-05-21 09:15:40]
  • 提交

answer

#pragma GCC optimize("Ofast","inline")
#include<bits/stdc++.h>
using namespace std;
const int N=5e3+60,M=4.5e3;

int a,b,c,s1,s2,p[5][6];

main()
{
    // freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
    cout<<"1 0 0"<<endl;cin>>a;
    cout<<"0 1 0"<<endl;cin>>b;
    cout<<"0 0 1"<<endl;cin>>c;
    cout<<"2 1 1"<<endl;cin>>s1;
    cout<<"1 2 1"<<endl;cin>>s2;
    if(a+b+c+a==s1||a+b+c+b==s2)
    {
        cout<<a<<' '<<b<<' '<<c<<endl;
        return 0;
    }
    p[1][1]=a;p[1][2]=s2-s1+a;p[1][3]=s1-a-a-p[1][2];
    p[2][2]=b;p[2][1]=s1-s2+b;p[2][3]=s2-b-b-p[2][1];
    p[3][3]=c;int x=s1+s2+c;
    if(x%3!=0)
    {
        cout<<p[1][1]<<' '<<p[1][2]<<' '<<p[1][3]<<endl;
        return 0;
    }
    x/=3;p[3][1]=s1-x;p[3][2]=s2-x;
    for(int i=1;i<=3;i++)
    for(int j=i+1;j<=3;j++)
    {
        int f=0;
        for(int k=1;k<=3;k++)f|=(p[i][k]!=p[j][k]);
        if(f)continue;
        cout<<p[i][1]<<' '<<p[i][2]<<' '<<p[i][3]<<endl;
        return 0;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3612kb

input:

1
2
3
7
8

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
1 2 3

result:

ok correct!

Test #2:

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

input:

9998
1
1
19998
10001

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
9998 1 1

result:

ok correct!

Test #3:

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

input:

3333
3333
3333
13332
13332

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
3333 3333 3333

result:

ok correct!

Test #4:

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

input:

892
503
712
3001
2611

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
893 503 712

result:

ok correct!

Test #5:

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

input:

868
365
947
3050
2549

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
868 367 947

result:

ok correct!

Test #6:

score: 0
Accepted
time: 1ms
memory: 3696kb

input:

684
827
794
2988
3131

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
684 827 793

result:

ok correct!

Test #7:

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

input:

308
23
440
1077
794

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
308 23 440

result:

ok correct!

Test #8:

score: 0
Accepted
time: 1ms
memory: 3560kb

input:

705
910
341
2661
2867

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
705 910 341

result:

ok correct!

Test #9:

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

input:

1482
1285
299
4546
4350

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
1481 1285 299

result:

ok correct!

Test #10:

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

input:

1516
3576
839
7446
9505

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
1516 3575 839

result:

ok correct!

Test #11:

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

input:

2254
132
1126
5767
3645

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
2254 132 1127

result:

ok correct!

Test #12:

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

input:

801
38
56
1695
933

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
801 38 56

result:

ok correct!

Test #13:

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

input:

1004
1248
3876
7132
7375

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
1004 1248 3876

result:

ok correct!

Test #14:

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

input:

2011
3884
1618
9528
11399

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
2013 3884 1618

result:

ok correct!

Test #15:

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

input:

1256
6632
214
9359
14736

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
1256 6633 214

result:

ok correct!

Test #16:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

805
4142
694
6445
9782

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
805 4142 693

result:

ok correct!

Test #17:

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

input:

731
4440
1054
6954
10665

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
731 4440 1054

result:

ok correct!

Test #18:

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

input:

445
3442
4035
8367
11365

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
445 3442 4035

result:

ok correct!

Test #19:

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

input:

1750
2
3
7
8

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
1 2 3

result:

ok correct!

Test #20:

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

input:

1
2
3
7
8

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
1 2 3

result:

ok correct!

Test #21:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

1
2
3
7
8

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
1 2 3

result:

ok correct!

Test #22:

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

input:

1
2
3
11819
8

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
1 2 3

result:

ok correct!

Test #23:

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

input:

1
2
3
7
7

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
1 2 3

result:

ok correct!

Test #24:

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

input:

1633
1
1
19998
10001

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
9998 1 1

result:

ok correct!

Test #25:

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

input:

9998
1
1
19998
10001

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
9998 1 1

result:

ok correct!

Test #26:

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

input:

9998
1
671
19998
10001

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
9998 1 1

result:

ok correct!

Test #27:

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

input:

9998
1
1
19996
10001

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
9998 1 1

result:

ok correct!

Test #28:

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

input:

9998
1
1
19998
8640

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
9998 1 1

result:

ok correct!

Test #29:

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

input:

3332
3333
3333
13332
13332

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
3333 3333 3333

result:

ok correct!

Test #30:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

3333
3332
3333
13332
13332

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
3333 3333 3333

result:

ok correct!

Test #31:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

3333
3333
3333
13332
13332

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
3333 3333 3333

result:

ok correct!

Test #32:

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

input:

3333
3333
3333
13333
13332

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
3333 3333 3333

result:

ok correct!

Test #33:

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

input:

3333
3333
3333
13332
13333

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
3333 3333 3333

result:

ok correct!

Test #34:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

548
588
724
2398
2443

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
543 588 724

result:

ok correct!

Test #35:

score: 0
Accepted
time: 1ms
memory: 3572kb

input:

780
1559
783
3304
3485

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
780 961 783

result:

ok correct!

Test #36:

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

input:

690
189
313
1881
1380

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
690 189 312

result:

ok correct!

Test #37:

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

input:

97
289
971
1455
1646

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
97 289 971

result:

ok correct!

Test #38:

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

input:

298
118
177
891
5803

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
298 118 177

result:

ok correct!

Test #39:

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

input:

2974
1358
2553
9859
8243

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
2974 1358 2553

result:

ok correct!

Test #40:

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

input:

4209
360
3000
13576
11525

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
4209 2158 3000

result:

ok correct!

Test #41:

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

input:

1199
99
4408
6905
5805

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
1199 99 4408

result:

ok correct!

Test #42:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

3601
167
1004
8375
4939

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
3601 167 1004

result:

ok correct!

Test #43:

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

input:

2721
2111
2489
10042
9431

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
2721 2111 2489

result:

ok correct!

Test #44:

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

input:

551
203
5220
12817
9323

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
3697 203 5220

result:

ok correct!

Test #45:

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

input:

1481
1259
1264
6451
7195

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
1481 2225 1264

result:

ok correct!

Test #46:

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

input:

4769
1552
235
11481
8264

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
4769 1552 391

result:

ok correct!

Test #47:

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

input:

1620
3589
1642
8472
10440

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
1620 3589 1642

result:

ok correct!

Test #48:

score: 0
Accepted
time: 1ms
memory: 3568kb

input:

1136
6652
800
9724
15241

output:

1 0 0
0 1 0
0 0 1
2 1 1
1 2 1
1136 6652 800

result:

ok correct!

Extra Test:

score: 0
Extra Test Passed