# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
268595 | A02 | Scales (IOI15_scales) | C++14 | 1 ms | 384 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 <vector>
#include <set>
#include <algorithm>
#include <utility>
#include <iostream>
using namespace std;
void init(int T) {
/* ... */
return;
}
void erasev(vector<int> &a, int b){
for (int i = 0; i < a.size(); i++){
if (a[i] == b){
a.erase(a.begin() + i);
}
}
}
void orderCoins() {
/* ... */
int W[] = {1, 2, 3, 4, 5, 6};
int l1 = getLightest(1, 2, 3);
int l2 = getLightest(4, 5, 6);
int s = 1;
if (1 == l1){
s = 2;
}
int l = getLightest(l1, l2, s);
vector<int> remaining;
for (int i = 1; i <= 6; i++){
if (i != l){
remaining.push_back(i);
}
}
l1 = getNextLightest(remaining[0], remaining[1], remaining[2], l);
l2 = getNextLightest(remaining[4], remaining[3], l1, l);
W[0] = l;
W[1] = l2;
erasev(remaining, l2);
int l3 = getNextLightest(remaining[0], remaining[1], remaining[2], l2);;
int l4 = getNextLightest(remaining[3], l, l3, l2);
W[2] = l4;
erasev(remaining, l4);
int l5 = getNextLightest(remaining[0], remaining[1], remaining[2], l4);
W[3] = l5;
W[4] = getMedian(remaining[0], remaining[1], remaining[2]);
erasev(remaining, W[3]);
erasev(remaining, W[4]);
W[5] = remaining[0];
//cout << W[0] << W[1] << W[2] << W[3] << W[4] << W[5] << endl;
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |