# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
652549 | jiahng | Scales (IOI15_scales) | C++14 | 1 ms | 336 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;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector <int> vi;
typedef vector <pi> vpi;
typedef pair<pi, ll> pii;
typedef set <ll> si;
typedef long double ld;
#define f first
#define s second
#define mp make_pair
#define FOR(i,s,e) for(int i=s;i<=int(e);++i)
#define DEC(i,s,e) for(int i=s;i>=int(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define maxn 200010
#define INF (ll)1e9
#define MOD 1000000007
typedef pair <vi, int> pvi;
typedef pair <int,pi> ipi;
typedef vector <pii> vpii;
vi ans;
int lans[6];
void solve(vi v){
if (v.size() == 3){
int a = getLightest(v[0],v[1],v[2]);
int b = getMedian(v[0],v[1],v[2]);
int c = getHeaviest(v[0],v[1],v[2]);
ans.pb(a); ans.pb(b); ans.pb(c);
return;
}
int mn = v[0];
for (int i = 1; i < v.size(); i += 2){
if (i + 1 == (int)v.size()){
int x;
aFOR(j, v) if (j != mn && j != v[i]) x = j;
mn = getLightest(mn, v[i], x);
}else mn = getLightest(mn, v[i], v[i+1]);
}
ans.pb(mn);
v.erase(find(all(v), mn));
solve(v);
}
void init(int T) {
}
void orderCoins() {
ans.clear();
solve({1,2,3,4,5,6});
//aFOR(i, ans) cout << i << ' '; cout << '\n';
FOR(i,0,5) lans[i] = ans[i];
answer(lans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |