# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
550417 | elazarkoren | Scales (IOI15_scales) | C++17 | 1 ms | 340 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 <bits/stdc++.h>
#include "scales.h"
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define chkmin(a, b) a = min(a, b)
#define chkmax(a, b) a = max(a, b)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
void init(int T) {
}
//void Sort(int i, int j, int k, int *w) {
// int x = getLightest(w[i], w[j], w[k]);
// int y = getMedian(w[i], w[j], w[k]);
//}
void orderCoins() {
int w[] = {1, 2, 3, 4, 5, 6};
while (true) {
bool b = false;
for (int i = 0; i < 4; i++) {
int x = getLightest(w[i], w[i + 1], w[i + 2]);
if (x != w[i]) {
b = true;
}
for (int j = i + 1; j < i + 3; j++) {
if (x == w[j]) {
swap(w[i], w[j]);
break;
}
}
}
if (!b) break;
}
int x = getMedian(w[3], w[4], w[5]);
if (x != w[4]) swap(w[4], w[5]);
answer(w);
}
//1
//3 4 6 2 1 5
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |