# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
946140 | Nika533 | Scales (IOI15_scales) | C++14 | 1 ms | 600 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.
#pragma GCC diagnostic warning "-std=c++11"
#include <bits/stdc++.h>
#include "scales.h"
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
#define flush fflush(stdout)
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pii pair<int,int>
using namespace std;
int n,m,k;
void init(int T) {
}
int check(int a, int arr[]) {
int sz=a-1;
int x=getNextLightest(arr[sz-3],arr[sz-2],arr[sz-1],a);
if (x==arr[sz-1]) {
if (getHeaviest(arr[sz-2],arr[sz-1],a)==a) {
x=getNextLightest(arr[0],arr[1],arr[2],a);
if (x==arr[2]) {
if (getHeaviest(arr[0],arr[1],a)==a) {
x=-1;
}
}
}
}
int indd=x;
for (int i=0; i<sz; i++) if (arr[i]==x) indd=i;
return indd;
}
void orderCoins() {
int w[6];
int a[3];
int lb;
a[2]=getLightest(1,2,3);
a[1]=getMedian(1,2,3);
a[0]=getHeaviest(1,2,3);
int x=check(4,a);
int b[4],ind=0;
for (int i=0; i<3; i++) {
if (x==i-1) {
b[ind]=4;
ind++;
}
b[ind]=a[i];
ind++;
}
if (x==2) b[3]=4;
int y=check(5,b);
int c[5]; ind=0;
for (int i=0; i<4; i++) {
if (y==i-1) {
c[ind]=5;
ind++;
}
c[ind]=b[i];
ind++;
}
if (y==3) c[4]=5;
int z=check(6,c);
ind=0;
for (int i=0; i<5; i++) {
if (z==i-1) {
w[ind]=6;
ind++;
}
w[ind]=c[i];
ind++;
}
if (z==4) w[5]=6;
reverse(w,w+6);
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |