# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
793543 | Username4132 | Scales (IOI15_scales) | C++14 | 1 ms | 276 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<vector>
#include<iostream>
using namespace std;
#define PB push_back
#define forn(i, n) for(int i=0; i<(int)n; ++i)
vector<int> order3(vector<int> v){
int a = getLightest(v[0], v[1], v[2]);
int b = getMedian(v[0], v[1], v[2]);
int c = ((v[0]==a || v[0]==b)? ((v[1]==a || v[1]==b)? v[2] : v[1] ) : v[0]);
return {a, b, c};
}
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
int cnt=4;
vector<int> v1 = order3({1, 2, 3}), v2 = order3({4, 5, 6}), ret;
int i=0, j=0;
while(i<3 && j<3){
bool res;
++cnt;
if(i<2) res=(getLightest(v1[i], v1[i+1], v2[j])==v1[i]);
else res=(getHeaviest(v1[i], v1[i-1], v2[j])==v2[j]);
if(res) ret.PB(v1[i++]);
else ret.PB(v2[j++]);
}
while(i<3) ret.PB(v1[i++]);
while(j<3) ret.PB(v2[j++]);
while(cnt<9) getLightest(1, 2, 3), ++cnt;
int W[6];
forn(ind, 6) W[ind]=ret[ind];
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |