# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
603170 | StrawHatWess | Scales (IOI15_scales) | C++17 | 2 ms | 300 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;
#define FOR(i,a,b) for(int i=a; i<b; i++)
#define ROF(i,a,b) for(int i=b-1; i>=a; i--)
typedef vector<int>vi;
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x),end(x)
//------
void init(int T) {
return;
}
void orderCoins() {
int x=getLightest(1,2,3), y=getMedian(1,2,3), z;
FOR(i,1,4) if(i!=x && i!=y) z=i;
vi a={x,y,z};
x=getLightest(4,5,6), y=getMedian(4,5,6), z;
FOR(i,4,7) if(i!=x && i!=y) z=i;
vi b={x,y,z};
vi vec={a[0],b[0],a[1],b[1],a[2],b[2]};
vi order;
int rep=6;
while(rep--){
vi cur;
for(int x: vec) if(x!=-1){
cur.pb(x);
if(sz(cur)==3) break;
}
if(!sz(cur)) break;
if(sz(cur)==1){
order.pb(cur[0]);
}
else if(sz(cur)==2){
int k;
FOR(i,1,7) if(i!=cur[0] && i!=cur[1]){
k=i; break;
}
x=getMedian(k,cur[0],cur[1]);
order.pb(x);
for(int &val: vec) if(val==x){val=-1; break;}
}
else{
x=getLightest(cur[0],cur[1],cur[2]);
order.pb(x);
for(int &val: vec) if(val==x){val=-1; break;}
}
}
int W[] = {order[0],order[1],order[2],order[3],order[4],order[5]};
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |