# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1061472 | anango | Scales (IOI15_scales) | C++17 | 1 ms | 600 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;
int testcases;
void init(int T) {
/* ... */
testcases = T;
}
void orderCoins() {
/* ... */
set<int> lev0;
set<int> lev1={1,2,3,4,5,6};
set<int> lev2;
set<int> lev3;
for (int i=0; i<1; i++) {
int a = *lev1.begin(); lev1.erase(a);
int b = *lev1.begin(); lev1.erase(b);
int c = *lev1.begin(); lev1.erase(c);
int bef = getLightest(a,b,c);
lev1.insert(a); lev1.insert(b); lev1.insert(c); lev1.erase(bef);
lev0.insert(bef);
}
for (int i=0; i<3; i++) {
int a = *lev1.begin(); lev1.erase(a);
int b = *lev1.begin(); lev1.erase(b);
int c = *lev1.begin(); lev1.erase(c);
int bef = getHeaviest(a,b,c);
lev1.insert(a); lev1.insert(b); lev1.insert(c); lev1.erase(bef);
lev2.insert(bef);
}
for (int i=0; i<1; i++) {
int a = *lev2.begin(); lev2.erase(a);
int b = *lev2.begin(); lev2.erase(b);
int c = *lev2.begin(); lev2.erase(c);
int bef = getHeaviest(a,b,c);
lev2.insert(a); lev2.insert(b); lev2.insert(c); lev2.erase(bef);
lev3.insert(bef);
}
/*cout << "LEVELS" << endl;
for (auto i:lev0) {
cout << i <<" ";
}
cout << endl;
for (auto i:lev1) {
cout << i <<" ";
}
cout << endl;
for (auto i:lev2) {
cout << i <<" ";
}
cout << endl;
for (auto i:lev3) {
cout << i <<" ";
}
cout << endl;*/
int a,b,c,d,e,f;
a = *lev0.begin();
b = *lev1.begin();
c = *lev1.rbegin();
d = *lev2.begin();
e = *lev2.rbegin();
f = *lev3.begin();
if (getMedian(b,c,d)==b) {
swap(b,c);
}
if (getMedian(c,d,e)==e) {
swap(d,e);
}
int W[6] = {a,b,c,d,e,f};
answer(W);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |