# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
356669 | urd05 | Scales (IOI15_scales) | C++14 | 1 ms | 512 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) {
/* ... */
}
int g(vector<int> v) {
for(int i=1;i<=6;i++) {
for(int j=0;j<v.size();j++) {
if (v[j]==i) {
break;
}
if (j+1==v.size()) {
return i;
}
}
}
}
int get(vector<int> v) {
if (v.size()==1) {
return v[0];
}
if (v.size()==6) {
int a=getLightest(1,2,3);
int b=getLightest(4,5,6);
int c;
for(int i=1;i<=6;i++) {
if (i!=a&&i!=b) {
c=i;
}
}
return getLightest(a,b,c);
}
int val=v[0];
for(int i=1;i<v.size();i+=2) {
if (i+1==v.size()) {
val=getMedian(val,v[i],g(v));
continue;
}
val=getLightest(val,v[i],v[i+1]);
}
return val;
}
void orderCoins() {
int W[6];
vector<int> v;
for(int i=1;i<=6;i++) {
v.push_back(i);
}
for(int i=0;i<6;i++) {
vector<int> nt;
W[i]=get(v);
for(int j=0;j<v.size();j++) {
if (v[j]!=W[i]) {
nt.push_back(v[j]);
}
}
v.clear();
for(int j=0;j<nt.size();j++) {
v.push_back(nt[j]);
}
}
answer(W);
return;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |