QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#780359#8674. Riddle of the Sphinxucup-team5217#AC ✓1ms3952kbC++232.2kb2024-11-25 10:22:252024-11-25 10:22:31

Judging History

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

  • [2024-11-25 10:22:31]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3952kb
  • [2024-11-25 10:22:25]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

double a[10][10];
double b[10][10];
map<pair<pair<double, double>, double>, int> vis; 

void solve(int i1, int i2, int i3) {
    // for (int i = 1/s)
    for (int i = 1; i <= 4; ++i) {
        a[1][i] = b[i1][i];
    }
    for (int i = 1; i <= 4; ++i) {
        a[2][i] = b[i2][i];
    }
    for (int i = 1; i <= 4; ++i) {
        a[3][i] = b[i3][i];
    }
    for (int i = 1; i <= 3; ++i) {
        // for (int j = 1; j <= )
        if (a[i][i] == 0) {
            for (int j = i + 1; j <= 3; ++j) {
                if (a[j][i]) {
                    for (int k = 1; k <= 4; ++k) {
                        swap(a[i][k], a[j][k]);
                    }
                    break;
                }
            }
        }
        for (int j = 1; j <= 3; ++j) {
            if (i == j) continue;
            double div = a[j][i] / a[i][i];
            for (int k = 1; k <= 4; ++k) {
                a[j][k] -= a[i][k] * div;
            }
        }
    }
    for (int i = 1; i <= 3; ++i) {
        a[i][4] /= a[i][i];
        // vis[make_pair(make_pair(a[1./][1], a[1][2]), a)]
    }
    vis[make_pair(make_pair(a[1][4], a[2][4]), a[3][4])]++;
}

int main() {
    cout << 1 << ' ' << 0 << ' ' << 0 << endl;
    b[1][1] = 1, b[1][2] = 0, b[1][3] = 0;
    cin >> b[1][4];
    cout << 0 << ' ' << 1 << ' ' << 0 << endl;
    b[2][1] = 0, b[2][2] = 1, b[2][3] = 0;
    cin >> b[2][4];
    cout << 0 << ' ' << 0 << ' ' << 1 << endl;
    b[3][1] = 0, b[3][2] = 0, b[3][3] = 1;
    cin >> b[3][4];
    cout << 1 << ' ' << 1 << ' ' << 1 << endl;
    b[4][1] = 1, b[4][2] = 1, b[4][3] = 1;
    cin >> b[4][4];
    cout << 1 << ' ' << 2 << ' ' << 3 << endl;
    b[5][1] = 1, b[5][2] = 2, b[5][3] = 3;
    cin >> b[5][4];
    solve(1, 2, 3);
    solve(1, 2, 4);
    solve(1, 2, 5);
    solve(1, 3, 4);
    solve(1, 3, 5);
    solve(1, 4, 5);
    solve(2, 3, 4);
    solve(2, 3, 5);
    solve(2, 4, 5);
    solve(3, 4, 5);
    for (auto it : vis) {
        if (it.second == 4 || it.second == 10) {
            cout << it.first.first.first << ' ' << it.first.first.second << ' ' << it.first.second << endl;
            return 0;
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
2
3
6
14

output:

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

result:

ok correct!

Test #2:

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

input:

9998
1
1
10000
10003

output:

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

result:

ok correct!

Test #3:

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

input:

3333
3333
3333
9999
19998

output:

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

result:

ok correct!

Test #4:

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

input:

892
503
712
2108
4035

output:

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

result:

ok correct!

Test #5:

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

input:

868
365
947
2182
4443

output:

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

result:

ok correct!

Test #6:

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

input:

684
827
794
2304
4717

output:

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

result:

ok correct!

Test #7:

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

input:

308
23
440
769
1674

output:

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

result:

ok correct!

Test #8:

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

input:

705
910
341
1956
3549

output:

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

result:

ok correct!

Test #9:

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

input:

1482
1285
299
3065
4948

output:

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

result:

ok correct!

Test #10:

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

input:

1516
3576
839
5930
11183

output:

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

result:

ok correct!

Test #11:

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

input:

2254
132
1126
3513
5899

output:

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

result:

ok correct!

Test #12:

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

input:

801
38
56
894
1045

output:

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

result:

ok correct!

Test #13:

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

input:

1004
1248
3876
6128
15127

output:

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

result:

ok correct!

Test #14:

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

input:

2011
3884
1618
7515
14635

output:

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

result:

ok correct!

Test #15:

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

input:

1256
6632
214
8103
15164

output:

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

result:

ok correct!

Test #16:

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

input:

805
4142
694
5640
11168

output:

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

result:

ok correct!

Test #17:

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

input:

731
4440
1054
6223
12773

output:

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

result:

ok correct!

Test #18:

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

input:

445
3442
4035
7922
19435

output:

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

result:

ok correct!

Test #19:

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

input:

1750
2
3
6
14

output:

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

result:

ok correct!

Test #20:

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

input:

1
2
3
6
14

output:

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

result:

ok correct!

Test #21:

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

input:

1
2
3
6
14

output:

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

result:

ok correct!

Test #22:

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

input:

1
2
3
8664
14

output:

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

result:

ok correct!

Test #23:

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

input:

1
2
3
6
11

output:

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

result:

ok correct!

Test #24:

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

input:

1633
1
1
10000
10003

output:

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

result:

ok correct!

Test #25:

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

input:

9998
1
1
10000
10003

output:

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

result:

ok correct!

Test #26:

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

input:

9998
1
671
10000
10003

output:

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

result:

ok correct!

Test #27:

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

input:

9998
1
1
9999
10003

output:

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

result:

ok correct!

Test #28:

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

input:

9998
1
1
10000
14730

output:

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

result:

ok correct!

Test #29:

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

input:

3332
3333
3333
9999
19998

output:

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

result:

ok correct!

Test #30:

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

input:

3333
3332
3333
9999
19998

output:

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

result:

ok correct!

Test #31:

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

input:

3333
3333
3333
9999
19998

output:

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

result:

ok correct!

Test #32:

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

input:

3333
3333
3333
10000
19998

output:

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

result:

ok correct!

Test #33:

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

input:

3333
3333
3333
9999
20001

output:

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

result:

ok correct!

Test #34:

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

input:

548
588
724
1855
3891

output:

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

result:

ok correct!

Test #35:

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

input:

780
1559
783
2524
5051

output:

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

result:

ok correct!

Test #36:

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

input:

690
189
313
1191
2004

output:

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

result:

ok correct!

Test #37:

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

input:

97
289
971
1358
3588

output:

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

result:

ok correct!

Test #38:

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

input:

298
118
177
593
8675

output:

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

result:

ok correct!

Test #39:

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

input:

2974
1358
2553
6885
13349

output:

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

result:

ok correct!

Test #40:

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

input:

4209
360
3000
9367
17525

output:

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

result:

ok correct!

Test #41:

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

input:

1199
99
4408
5706
14621

output:

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

result:

ok correct!

Test #42:

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

input:

3601
167
1004
4773
6947

output:

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

result:

ok correct!

Test #43:

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

input:

2721
2111
2489
7321
14407

output:

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

result:

ok correct!

Test #44:

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

input:

551
203
5220
9120
19763

output:

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

result:

ok correct!

Test #45:

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

input:

1481
1259
1264
4970
9723

output:

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

result:

ok correct!

Test #46:

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

input:

4769
1552
235
6712
9046

output:

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

result:

ok correct!

Test #47:

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

input:

1620
3589
1642
6852
13724

output:

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

result:

ok correct!

Test #48:

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

input:

1136
6652
800
8588
16841

output:

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

result:

ok correct!

Extra Test:

score: 0
Extra Test Passed