# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
783790 | Lyrically | Scales (IOI15_scales) | C++17 | 1 ms | 256 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<bits/stdc++.h>
#include "scales.h"
using namespace std;
#define pii pair<int,int>
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
int read(){int x;scanf("%d",&x);return x;}
void print(int x){printf("%d\n",x);}
void file(string s)
{
freopen((s+".in").c_str(),"r",stdin);
freopen((s+".out").c_str(),"w",stdout);
}
const int mod=998244353;
void init(int T){}
//getLightest,getHeaviest,getMedian,getNextLightest
void orderCoins()
{
int ans[6];bool fl[7]={0};
int a=getLightest(1,2,3),b=getLightest(4,5,6);
set<int> v;rep1(i,6){v.insert(i);}
rep1(i,6)
{
if(i!=a&&i!=b)
{
int c=getLightest(a,b,i);
ans[0]=c;fl[c]=1;v.erase(c);break;
}
}
vector<int> p;
for(auto x:v){p.pb(x);}
int d=getLightest(p[0],p[1],p[2]),e=getLightest(d,p[3],p[4]);
ans[1]=e;
v.erase(e);
p.clear();for(auto x:v){p.pb(x);}
int f=getLightest(p[0],p[1],p[2]);
int id=-1;
rep(i,3){if(f!=p[i]){id=i;break;}}
int g=getLightest(f,p[id],p[3]);
ans[2]=g;v.erase(g);
p.clear();for(auto x:v){p.pb(x);}
int h=getLightest(p[0],p[1],p[2]);
ans[3]=h;
int k=getMedian(p[0],p[1],p[2]);
ans[4]=k;
rep(i,3)
{
if(p[i]!=h&&p[i]!=k){ans[5]=p[i];break;}
}
answer(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |