# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
596944 | PiejanVDC | Scales (IOI15_scales) | C++17 | 1 ms | 212 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) {
}
void orderCoins() {
int vis[7][7][7];
for(int i = 1 ; i <= 6 ; i++)
for(int j = 1 ; j <= 6 ; j++)
for(int k = 1 ; k <= 6 ; k++)
vis[i][j][k] = 0;
int ans[6] = {1, 2, 3, 4, 5, 6};
int a = getLightest(1, 2, 3);
vis[1][2][3] = a;
int b = getLightest(4, 5, 6);
vis[4][5][6] = b;
int c;
for(int i = 1 ; i <= 6 ; i++) if(i != a && i != b)
c = i;
ans[0] = getLightest(a, b, c);
vis[a][b][c] = ans[0];
vector<int>r;
for(int i = 1 ; i <= 6 ; i++) if(i != ans[0])
r.push_back(i);
int d;
if(vis[r[2]][r[3]][r[4]])
d = vis[r[2]][r[3]][r[4]];
else
d = vis[r[2]][r[3]][r[4]] = getLightest(r[2], r[3], r[4]);
if(vis[r[0]][r[1]][d])
a = vis[r[0]][r[1]][d];
else
a = vis[r[0]][r[1]][d] = getLightest(r[0], r[1], d);
ans[1] = a;
r.clear();
for(int i = 1 ; i <= 6 ; i++) if(i != ans[0] && i != ans[1])
r.push_back(i);
if(vis[r[0]][r[1]][r[2]])
a = vis[r[0]][r[1]][r[2]];
else
a = vis[r[0]][r[1]][r[2]] = getLightest(r[0], r[1], r[2]);
r.clear();
for(int i = 1 ; i <= 6 ; i++) if(i != ans[0] && i != ans[1] && i != a)
r.push_back(i);
if(vis[a][r[0]][r[2]])
ans[2] = vis[a][r[0]][r[2]];
else
ans[2] = vis[a][r[0]][r[2]] = getLightest(a, r[0], r[2]);
r.clear();
for(int i = 1 ; i <= 6 ; i++) if(i != ans[0] && i != ans[1] && i != ans[2])
r.push_back(i);
if(vis[r[0]][r[1]][r[2]])
ans[3] = vis[r[0]][r[1]][r[2]];
else
ans[3] = vis[r[0]][r[1]][r[2]] = getLightest(r[0], r[1], r[2]);
r.clear();
for(int i = 1 ; i <= 6 ; i++) if(i != ans[0] && i != ans[1] && i != ans[2] && i != ans[3])
r.push_back(i);
ans[5] = getHeaviest(r[0], r[1], ans[0]);
for(int i = 1 ; i <= 6 ; i++) if(i != ans[0] && i != ans[1] && i != ans[2] && i != ans[3] && i != ans[5])
ans[4] = i;
answer(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |