# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
284112 | diegoangulo5 | Scales (IOI15_scales) | C++14 | 1 ms | 372 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;
vector<int>n;
void init(int T) {
/* ... */
}
int excluir(int a, int b, int x, int y, int z){
if(a!=x && b!=x)return x;
if(a!=y && b!=y)return y;
return z;
}
int excluir(int a, int x, int y, int z){
if(a!=x)return x;
return y;
}
void quitar(int a){
vector<int>::iterator it = n.begin();
for(;it!=n.end();it++){
if(*it == a){
n.erase(it);
return;
}
}
}
void orderCoins() {
n.clear();
for(int a=0;a<6;a++)n.push_back(a+1);
int w[6] = {0,0,0,0,0,0};
int a = getLightest(1,2,3);
int b = getLightest(4,5,6);
int c;
w[0] = getLightest(a,b, excluir(a, 1, 2, 3));
quitar(w[0]);
if(w[0] == a){
c = excluir(a, 1, 2, 3);
w[1] = getLightest(b, c, excluir(a, c, 1, 2, 3));
}
if(w[0] == b){
c = excluir(b, 4, 5, 6);
w[1] = getLightest(a, c, excluir(b, c, 4, 5, 6));
}
quitar(w[1]);
a = getLightest(n[0], n[1], n[2]);
w[2] = getLightest(a, n[3], excluir(a, n[3], n[0], n[1], n[2]));
quitar(w[2]);
if(a!=w[2]){
w[3] = a;
}
else w[3] = getLightest(n[0], n[1], n[2]);
w[4] = getMedian(n[0], n[1], n[2]);
quitar(w[3]);
quitar(w[4]);
w[5] = n[0];
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |