# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
946300 | Nika533 | Scales (IOI15_scales) | C++14 | 1 ms | 348 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) {
}
void orderCoins() {
int w[6];
int a[6];
a[2]=getLightest(1,2,3);
a[1]=getMedian(1,2,3);
if (a[1]!=1 && a[2]!=1) a[0]=1;
if (a[1]!=2 && a[2]!=2) a[0]=2;
if (a[1]!=3 && a[2]!=3) a[0]=3;
a[5]=getLightest(4,5,6);
a[4]=getMedian(4,5,6);
if (a[4]!=4 && a[5]!=4) a[3]=4;
if (a[4]!=5 && a[5]!=5) a[3]=5;
if (a[4]!=6 && a[5]!=6) a[3]=6;
int x3=getNextLightest(1,2,3,a[3]);
int x4=getNextLightest(1,2,3,a[4]);
int x5=getNextLightest(1,2,3,a[5]);
for (int i=0; i<3; i++) {
if (a[i]==x3) {
x3=i; break;
}
}
for (int i=0; i<3; i++) {
if (a[i]==x4) {
x4=i; break;
}
}
for (int i=0; i<3; i++) {
if (a[i]==x5) {
x5=i; break;
}
}
if (x3==2) x3=3;
if (x4==2) x4=3;
if (x5==2) x5=3;
if (x3==3) {
if (x4!=3 || x5!=3) x3=-1;
}
if (x4==3) {
if (x3!=3) x4=2;
if (x5!=3) x4=-1;
}
if (x5==3) {
if (x3!=3 || x4!=3) x5=2;
}
if (x3==3 && x4==3 && x5==3) {
if (getHeaviest(1,2,a[4])==a[4]) {
x3=-1; x4=-1;
if (getHeaviest(1,2,a[5])==a[5]) {
x5=-1;
}
else x5=2;
}
else {
x4=2; x5=2;
if (getHeaviest(1,2,a[3])==a[3]) {
x3=-1;
}
else {
x3=2;
}
}
}
int ind=0;
for (int i=0; i<3; i++) {
if (x3==i-1) {
w[ind]=a[3];
ind++;
}
if (x4==i-1) {
w[ind]=a[4];
ind++;
}
if (x5==i-1) {
w[ind]=a[5];
ind++;
}
w[ind]=a[i];
ind++;
}
if (x3==2) {
w[ind]=a[3];
ind++;
}
if (x4==2) {
w[ind]=a[4];
ind++;
}
if (x5==2) {
w[ind]=a[5];
ind++;
}
reverse(w,w+6);
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |