#include <bits/stdc++.h>
#include "scales.h"
#define ll long long
#define pb push_back
using namespace std;
void init(int T) {
}
/*ll getHeaviest(ll a, ll b, ll c) {
cout << "? max :" << a << " " << b << " " << c << '\n';
cin >> a;
return a;
}
ll getLightest(ll a, ll b, ll c) {
cout << "? min :" << a << " " << b << " " << c << '\n';
cin >> a;
return a;
} */
void orderCoins() {
int w[8] = {1, 2, 3, 4, 5, 6};
int ans[6] = {1, 2, 3, 4, 5, 6};
bool was[7] = {0};
for(int j = 0; j < 7; j++)
was[j] = 0;
int z1 = getHeaviest(1, 2, 3), z2 = getHeaviest(4, 5, 6);
int z3 = getHeaviest(z1, z2,(z1 == 1 ? 2 : 1));
ans[5] = z3;
if(z3 == z2) {
if(z3 == 4) z3 = getHeaviest(z1, 5, 6);
else if(z3 == 5) z3 = getHeaviest(z1, 4, 6);
else if(z3 == 6) z3 = getHeaviest(z1, 4, 5);
}
else {
if(z3 == 3) z3 = getHeaviest(z2, 1, 2);
else if(z3 == 2) z3 = getHeaviest(z2, 1, 3);
else if(z3 == 1) z3 = getHeaviest(z2, 2, 3);
}
ans[4] = z3;
was[ans[4]] = was[ans[5]] = 1;
ll it = 0;
for(int j = 1; j <= 6; j++)
if(!was[j])
w[it++] = j;
z1 = getLightest(w[0], w[1], w[2]);
z2 = getLightest(z1, w[3], w[2]);
ans[0] = z2;
was[ans[0]] = 1;
it = 0;
for(int j = 1; j <= 6; j++)
if(!was[j])
w[it++] = j;
ans[1] = getLightest(w[0], w[1], w[2]);
ans[3] = getHeaviest(w[0],w[1], w[2]);
was[ans[1]] = was[ans[3]] = 1;
it = 0;
for(int j = 1; j <= 6; j++)
if(!was[j])
w[it++] = j;
ans[2] = w[0];
// for(int i = 0; i < 6; i++)
// cout << ans[i] << " ";
answer(ans);
}
/*
int main() {
orderCoins();
}*/
Compilation message
scales.cpp: In function 'void init(int)':
scales.cpp:7:15: warning: unused parameter 'T' [-Wunused-parameter]
7 | void init(int T) {
| ~~~~^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
2 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
3 |
Runtime error |
1 ms |
420 KB |
Execution killed with signal 6 |
4 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
5 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
6 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
7 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
8 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
9 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
10 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
11 |
Runtime error |
1 ms |
416 KB |
Execution killed with signal 6 |
12 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
13 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
14 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
15 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
16 |
Runtime error |
1 ms |
420 KB |
Execution killed with signal 6 |
17 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
18 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
19 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
20 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
21 |
Runtime error |
1 ms |
416 KB |
Execution killed with signal 6 |
22 |
Runtime error |
1 ms |
416 KB |
Execution killed with signal 6 |
23 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
24 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
25 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
26 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
27 |
Runtime error |
1 ms |
416 KB |
Execution killed with signal 6 |
28 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
29 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
30 |
Runtime error |
1 ms |
416 KB |
Execution killed with signal 6 |
31 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
32 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
33 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
34 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
35 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
36 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
37 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
38 |
Runtime error |
1 ms |
424 KB |
Execution killed with signal 6 |
39 |
Runtime error |
1 ms |
420 KB |
Execution killed with signal 6 |
40 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |