# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
60762 | istlemin | Scales (IOI15_scales) | C++14 | 8 ms | 680 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;
#define rep(i,a,b) for(int i = a; i<int(b);++i)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define trav(a,c) for(auto a: c)
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pii;
vector<tuple<ll,ll,ll,ll> > heaviestOps;
ll heaviest(ll a,ll b,ll c){
if(a==b||b==c||c==a) return -1;
ll res = getHeaviest(a+1,b+1,c+1)-1;
heaviestOps.emplace_back(a,b,c,res);
return res;
}
vector<tuple<ll,ll,ll,ll> > lightestOps;
ll lightest(ll a,ll b,ll c){
if(a==b||b==c||c==a) return -1;
ll res = getLightest(a+1,b+1,c+1)-1;
lightestOps.emplace_back(a,b,c,res);
return res;
}
void init(int T) {
}
void orderCoins() {
heaviestOps.clear();
lightestOps.clear();
rep(i,0,100){
heaviest(rand()%6,rand()%6,rand()%6);
}
rep(i,0,100){
lightest(rand()%6,rand()%6,rand()%6);
}
vi W = {0,1,2,3,4,5};
do{
bool fail = false;
rep(i,0,heaviestOps.size()){
ll a,b,c,res;
tie(a,b,c,res) = heaviestOps[i];
if(max(W[a],max(W[b],W[c]))!=W[res])
fail = true;
}
rep(i,0,lightestOps.size()){
ll a,b,c,res;
tie(a,b,c,res) = lightestOps[i];
if(min(W[a],min(W[b],W[c]))!=W[res])
fail = true;
}
if(!fail) {
int ans[6];
rep(i,0,6) ans[W[i]] = i+1;
/*rep(i,0,6){
cout<<ans[i]+1<<" ";
}
cout<<endl;*/
answer(ans);
return;
}
} while(next_permutation(all(W)));
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |