# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1077291 | Trumling | Scales (IOI15_scales) | C++14 | 1 ms | 436 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 F first
#define S second
#define pb push_back
#define INF 99999999999999
#define all(x) x.begin(),x.end()
typedef long long ll;
ll n=6;
void init(int T) {
/* ... */
return ;
}
void orderCoins() {
/* ... */
vector<bool>vis(n+1,0);
int ans[6];
ll sz=n;
while(sz)
{
vector<ll>v;
v.pb(0);
for(int i=1;i<=n;i++)
if(!vis[i])
v.pb(i);
ll mini=v[1];
ll lose=v[1];
for(int i=2;i<=sz;i+=2)
{
if(i+1<=sz)
{
//cout<<"1 "<<mini<<','<<v[i]<<','<<v[i+1]<<'\n';
mini=getLightest(mini,v[i],v[i+1]);
if(mini!=v[i])
lose=i;
if(mini!=v[i+1])
lose=i+1;
}
else
if(i<=sz)
{
if(sz==2)
{
ll curr=getHeaviest(mini,v[i],ans[0]);
if(curr==mini)
mini=v[i];
}
else
{
// cout<<"2 "<<mini<<','<<v[i]<<','<<v[lose]<<'\n';
mini=getLightest(mini,v[i],v[lose]);
}
}
}
ans[n-sz]=mini;
sz--;
vis[mini]=1;
}
answer(ans);
return ;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |