# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
120192 | pavel | Scales (IOI15_scales) | C++14 | 0 ms | 0 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 <vector>
#include <algorithm>
#include <cstdio>
#include "scales.h"
using namespace std;
void init(int T) {
/* ... */
}
vector<int> graph[10];
void orderCoins() {
int W[6], wi=0;
int a = getLightest(1, 2, 3);
for(int i=1;i<=3;++i) if(a!=i) graph[a].push_back(i);
int b = getLightest(4, 5, 6);
for(int i=4;i<=6;++i) if(b!=i) graph[b].push_back(i);
if(getLightest(a, graph[a][0], b)==b) swap(a,b);
W[wi++]=a;
int x=getLightest(b, graph[a][0], graph[a][1]);
W[wi++]=x;
if(x==b){
graph[a].insert(graph[a].end(), graph[b].begin(), graph[b].end());
}else{
graph[a].erase(find(graph[a].begin(), graph[a].end(), x));
x = getLightest(graph[a][0], b, graph[b][0]);
W[wi++]=x;
if(x!=b){
graph[a].erase
W[wi++]=b;
}
graph[a].insert
}
}