# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
404661 | Dakto | Scales (IOI15_scales) | C++17 | 1 ms | 296 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) {
}
bool contains(vector<int>& v, int x){
return find(v.begin(),v.end(), x)!=v.end();
}
void orderCoins() {
vector<int> res;
while(res.size()<4){
vector<int> p,op;
for(int i=1; i<=6; i++){
if(!contains(res,i)){
p.push_back(i);
}
}
op=p;
while(p.size()>1){
set<int> q;
for(int j=0; j<=2 && p.size(); j++){
q.insert(p[0]);
p.erase(p.begin());
}
for(int j=0; q.size()<3; j++) q.insert(op[j]);
p.push_back(getLightest(*begin(q),*next(begin(q)),*next(begin(q),2)));
}
res.push_back(p[0]);
}
vector<int> p;
for(int i=1; i<=6; i++){
if(!contains(res,i)){
p.push_back(i);
}
}
auto x=getHeaviest(p[0],p[1],res[0]);
p.erase(find(p.begin(),p.end(),x));
res.push_back(p[0]);
res.push_back(x);
int out[6];
for(int i=0; i<6; i++) out[i]=res[i];
answer(out);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |