# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
158457 | 2019-10-17T07:37:48 Z | davitmarg | Scales (IOI15_scales) | C++17 | 2 ms | 376 KB |
/*DavitMarg*/ #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <set> #include <queue> #include <iomanip> #include <bitset> #include <stack> #include <cassert> #include <iterator> #include <fstream> #define mod 1000000000ll #define LL long long #define LD long double #define MP make_pair #define PB push_back #define all(v) v.begin(), v.end() using namespace std; #ifndef death #include "scales.h" #endif #ifdef death int getHeaviest(int a, int b, int c) { cout << "? Heavy" << a << " " << b << " " << c << endl; int res; cin >> res; return res; } int getMedian(int a, int b, int c) { cout << "? Median" << a << " " << b << " " << c << endl; int res; cin >> res; return res; } int getLightest(int a, int b, int c) { cout << "? Light" << a << " " << b << " " << c << endl; int res; cin >> res; return res; } int getNextLightest(int a, int b, int c, int d) { cout << "? " << a << " " << b << " " << c << " " << d << endl; int res; cin >> res; return res; } void answer(int *a) { cout << "! "; for (int i = 0; i < 6; i++) cout << a[i] << " "; cout << endl; } #endif int n = 6; void init(int T) { srand(644645 + T); } void orderCoins() { vector<int> ind, l, r, ans; for (int i = 1; i <= n; i++) ind.PB(i); random_shuffle(all(ind)); l.PB(getLightest(ind[0], ind[1], ind[2])); l.PB(getMedian(ind[0], ind[1], ind[2])); for (int i = 0; i < 3; i++) if (ind[i] != l[0] && ind[i] != l[1]) l.PB(ind[i]); r.PB(getLightest(ind[3], ind[4], ind[5])); r.PB(getMedian(ind[3], ind[4], ind[5])); for (int i = 3; i < n; i++) if (ind[i] != r[0] && ind[i] != r[1]) r.PB(ind[i]); reverse(all(l)); reverse(all(r)); ans.PB(getLightest(r.back(), l.back(), r[r.size() - 2])); if (ans.back() == r.back()) r.pop_back(); else l.pop_back(); while (!l.empty() || !r.empty()) { if (l.empty()) { ans.PB(r.back()); r.pop_back(); } else if (r.empty()) { ans.PB(l.back()); l.pop_back(); } else { ans.PB(getMedian(r.back(), l.back(), ans[0])); if (ans.back() == r.back()) r.pop_back(); else l.pop_back(); } } int ANS[6]; for (int i = 0; i < n; i++) ANS[i] = ans[i]; answer(ANS); } #ifdef death int main() { int T; cin >> T; init(T); while (T--) { orderCoins(); } return 0; } #endif /* 2 2 8 1 7 */
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 2 ms | 252 KB | Output is partially correct |
2 | Partially correct | 2 ms | 256 KB | Output is partially correct |
3 | Partially correct | 2 ms | 376 KB | Output is partially correct |
4 | Partially correct | 2 ms | 256 KB | Output is partially correct |
5 | Partially correct | 2 ms | 376 KB | Output is partially correct |
6 | Partially correct | 2 ms | 256 KB | Output is partially correct |
7 | Partially correct | 2 ms | 256 KB | Output is partially correct |
8 | Partially correct | 2 ms | 256 KB | Output is partially correct |
9 | Partially correct | 2 ms | 256 KB | Output is partially correct |
10 | Partially correct | 2 ms | 256 KB | Output is partially correct |
11 | Partially correct | 2 ms | 376 KB | Output is partially correct |
12 | Partially correct | 2 ms | 256 KB | Output is partially correct |
13 | Partially correct | 2 ms | 256 KB | Output is partially correct |
14 | Partially correct | 2 ms | 376 KB | Output is partially correct |
15 | Partially correct | 2 ms | 256 KB | Output is partially correct |
16 | Partially correct | 2 ms | 256 KB | Output is partially correct |
17 | Partially correct | 2 ms | 256 KB | Output is partially correct |
18 | Partially correct | 2 ms | 376 KB | Output is partially correct |
19 | Partially correct | 2 ms | 376 KB | Output is partially correct |
20 | Partially correct | 2 ms | 376 KB | Output is partially correct |
21 | Partially correct | 2 ms | 376 KB | Output is partially correct |
22 | Partially correct | 2 ms | 256 KB | Output is partially correct |
23 | Partially correct | 2 ms | 256 KB | Output is partially correct |
24 | Partially correct | 2 ms | 364 KB | Output is partially correct |
25 | Partially correct | 2 ms | 256 KB | Output is partially correct |
26 | Partially correct | 2 ms | 256 KB | Output is partially correct |
27 | Partially correct | 2 ms | 256 KB | Output is partially correct |
28 | Partially correct | 2 ms | 256 KB | Output is partially correct |
29 | Partially correct | 2 ms | 256 KB | Output is partially correct |
30 | Partially correct | 2 ms | 376 KB | Output is partially correct |
31 | Partially correct | 2 ms | 256 KB | Output is partially correct |
32 | Partially correct | 2 ms | 256 KB | Output is partially correct |
33 | Partially correct | 2 ms | 256 KB | Output is partially correct |
34 | Partially correct | 2 ms | 376 KB | Output is partially correct |
35 | Partially correct | 2 ms | 292 KB | Output is partially correct |
36 | Partially correct | 2 ms | 364 KB | Output is partially correct |
37 | Partially correct | 2 ms | 256 KB | Output is partially correct |
38 | Partially correct | 2 ms | 376 KB | Output is partially correct |
39 | Partially correct | 2 ms | 256 KB | Output is partially correct |
40 | Partially correct | 2 ms | 348 KB | Output is partially correct |