# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
558091 | emuyumi | Scales (IOI15_scales) | C++17 | 1 ms | 308 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) {
}
const vector<tuple<int, int, int>> cliques = {
{1, 3, 5}, {1, 3, 6},
{1, 4, 5}, {1, 4, 6},
{2, 3, 5}, {2, 3, 6},
{2, 4, 5}, {2, 4, 6}
};
void orderCoins() {
vector<vector<int>> adj(7);
vector<int> deg(7);
for (auto [a, b, c] : cliques){
int lo = getLightest(a, b, c);
int hi = getHeaviest(a, b, c);
int mi = a ^ b ^ c ^ lo ^ hi;
adj[lo].push_back(mi); deg[mi]++;
adj[lo].push_back(hi); deg[hi]++;
adj[mi].push_back(hi); deg[hi]++;
}
queue<int> q;
for (int i = 1; i <= 6; ++i){
if (!deg[i]) q.push(i);
}
vector<int> ord;
while (!q.empty()){
int v = q.front(); q.pop();
ord.push_back(v);
for (int to : adj[v]){
deg[to]--;
if (!deg[to]) q.push(to);
}
}
answer(ord.data());
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |