# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
588407 | Siffer | Scales (IOI15_scales) | C++14 | 1 ms | 312 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 "scales.h"
#include<bits/stdc++.h>
using namespace std;
void init(int T) {
//
}
void orderCoins() {
int W[] = {1, 2, 3, 4, 5, 6};
int a = getLightest(1,2,3);
int b = getLightest(4, 5, 6);
W[0] = getLightest(a, b, (a^1)?1:2);
//if(W[0]==a) cout << a << " " << b << " " << ((a^1)?1:2) << " " << ((a^1)?2^3^a:3) << endl;
//else cout << b << " " << a << " " << ((b^4)?4:5) << " " << ((b^4)?5^6^b:6) << endl;
if(W[0]==a) W[1] = getLightest(b,(a^1)?1:2,(a^1)?2^3^a:3);
else W[1] = getLightest(a,(b^4)?4:5,(b^4)?5^6^b:6);
vector<int> o = {1,2,3,4,5,6,W[0],W[1]};
sort(o.begin(), o.end());
for(int i = 0; i < 7; i++) {
if(o[i]==o[i+1]) {
o[i] = 10;
o[++i] = 10;
}
}
sort(o.begin(), o.end());
W[2] = getLightest(o[0], o[1], o[2]);
W[2] = getHeaviest(o[3], W[2], W[0])^o[3]^W[2];
o.push_back(W[2]);
sort(o.begin(), o.end());
for(int i = 0; i < 7; i++) {
if(o[i]==o[i+1]) {
o[i] = 10;
o[++i] = 10;
}
}
sort(o.begin(), o.end());
W[3] = getLightest(o[0], o[1], o[2]);
W[4] = getMedian(o[0], o[1], o[2]);
W[5] = o[0]^o[1]^o[2]^W[3]^W[4];
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |