# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
619634 | Mounir | Scales (IOI15_scales) | C++14 | 1 ms | 304 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>
#define all(x) x.begin(), x.end()
#define chmax(x, v) x = max(x, v)
#define chmin(x, v) x = min(x, v)
#define pii pair<int, int>
#define pb push_back
#define sz(x) (int)x.size()
#define x first
#define y second
//#define int long long
using namespace std;
void init(int T) {
/* ... */
}
void orderCoins() {
int W[6];
for (int i = 0; i < 6; ++i)
W[i] = -1;
set<int> reste = {1, 2, 3, 4, 5, 6};
for (int i = 0; i < 4; ++i){
/*cout << "tour " << i << endl;
for (int a : reste)
cout << a << " ";
cout << endl;
*/int mini = *reste.begin();
vector<int> file;
for (int a : reste)
file.pb(a);
reverse(all(file));
file.pop_back();
reverse(all(file));
/* for (int a : file)
cout << a << " ";
cout << endl << "--------" << endl;
*/ int pasMini = -1;
for (int i = 0; i < sz(file); i += 2){
int avant = mini;
if (i + 1 < sz(file)) {
// cout << "QUERY " << mini << " " << file[i] << " " << file[i + 1] << endl;
mini = getLightest(mini, file[i], file[i + 1]);
// cout << "ans" << mini << endl;
for (int j : {i, i + 1}){
if (mini != file[j])
pasMini = file[j];
}
if (avant != mini)
pasMini = avant;
}
else
mini = getLightest(mini, pasMini, file[i]);
}
// cout << "mini " << mini << endl;
reste.erase(mini);
W[i] = mini;
}
int a = *reste.begin();
reste.erase(reste.begin());
int b = *reste.begin();
W[5] = getHeaviest(W[0], a, b);
W[4] = a;
if (W[5] == W[4])
W[4] = b;
/* cout << "W" << endl;
for (int i = 0; i < 6; ++i)
cout << W[i] << " ";
cout << endl;*/
answer(W);
return;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |