# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
419492 | LastRonin | Scales (IOI15_scales) | C++14 | 1 ms | 424 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |