# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
358013 | beksultan04 | Scales (IOI15_scales) | C++14 | 1 ms | 492 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"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;
#define lol long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scanl(a) scanf("%lld",&a);
#define scanll(a,b) scanf("%lld %lld",&a, &b);
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12
void init(int T) {
ret ;
/* ... */
}
int vis[40];
void orderCoins() {
/* ... */
int i;
vector <int> v(6);
{
int a = getLightest(1,2,3);
int b = getLightest(4,5,6);
int c;
if (a == 1)
c = getLightest(a,2,b);
else
c = getLightest(a,1,b);
vis[c]=1;
if (c == a){
v[1] = b;
}
else v[1] = a;
v[0] = c;
}
{
int a=1,b,c,d,e;
while (vis[a])a++;
b = a+1;
while (vis[b])b++;
c = b+1;
while (vis[c])c++;
d = c+1;
while (vis[d])d++;
e = d+1;
while (vis[e])e++;
int r;
if (c > 3)
r = getLightest(a,b,v[1]);
else
r = getLightest(e,d,v[1]);
v[1] = r;
vis[r] = 1;
}
{
int a=1,b,c,d;
while (vis[a])a++;
b = a+1;
while (vis[b])b++;
c = b+1;
while (vis[c])c++;
d = c+1;
while (vis[d])d++;
int r = getNextLightest(a,b,c,v[0]);
if (r == a)
r = getNextLightest(r,d,b,v[0]);
else
r = getNextLightest(r,d,a,v[0]);
v[2] = r;
vis[r] = 1;
}
{
int a=1,b,c;
while (vis[a])a++;
b = a+1;
while (vis[b])b++;
c = b+1;
while (vis[c])c++;
int r = getNextLightest(a,b,c,v[0]);
v[3] = r;
vis[r] = 1;
}
{
int a=1,b;
while (vis[a])a++;
b = a+1;
while (vis[b])b++;
int r = getHeaviest(a,b,v[0]);
if (r == a){
v[5] = a;
v[4] = b;
}
else {
v[4] = a;
v[5] = b;
}
}
int W[6];
for (i=0;i<6;++i){
vis[i+1]=0;;
W[i] = v[i];
}
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |