# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
357970 | beksultan04 | Scales (IOI15_scales) | C++14 | 1 ms | 364 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;
v[0] = c;
}
{
int a = getHeaviest(1,2,3);
int b = getHeaviest(4,5,6);
int c;
if (a == 1)
c = getHeaviest(a,2,b);
else
c = getHeaviest(a,1,b);
vis[c]=1;
v[5] = c;
}
{
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 = getLightest(a,b,c);
r = getLightest(r,d,v[5]);
vis[r]=1;
v[1] = r;
}
{
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 = getLightest(a,b,c);
vis[r] = 1;
v[2] = r;
}
{
int a=1,b;
while (vis[a])a++;
b = a+1;
while (vis[b])b++;
int r = getLightest(a,b,v[5]);
if (r == a){
v[3] = a;
v[4] = b;
}
else {
v[4] = a;
v[3] = 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... |