# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
68380 | AlphaRazra | Scales (IOI15_scales) | C++14 | 4 ms | 880 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<bits/stdc++.h>
#include "scales.h"
using namespace std;
int jawab[7];
bool sudah[7];
void init(int T) {
}
void orderCoins() {
memset(sudah, false, sizeof(sudah));
int W[6];
int a[3], b[3];
a[0] = getLightest(1, 2, 3);
a[1] = getMedian(1, 2, 3);
a[2] = getHeaviest(1, 2, 3);
b[0] = getLightest(4, 5, 6);
b[1] = getMedian(4, 5, 6);
b[2] = getHeaviest(4, 5, 6);
int halo = getLightest(a[0], b[0], a[2]);
int ringan;
if(halo == a[0]){
jawab[a[0]] = 1;
ringan = a[0];
sudah[a[0]] = true;
}else if(halo == b[0]){
jawab[b[0]] = 1;
ringan = b[0];
sudah[b[0]] = true;
}
int idx1 = 2, idx2 = 2;
int haha = 6;
while(true){
int now = getHeaviest(a[idx1], b[idx2], ringan);
if(now == a[idx1]){
jawab[a[idx1]] = haha;
sudah[a[idx1]] = true;
haha--;
idx1--;
if(sudah[a[idx1]] || idx1 == -1){
break;
}
}else if(now == b[idx2]){
jawab[b[idx2]] = haha;
sudah[b[idx2]] = true;
haha--;
idx2--;
if(sudah[b[idx2]] || idx2 == -1){
break;
}
}
}
if(sudah[a[idx1]] || idx1 == -1){
while(!sudah[b[idx2]] && idx2 > -1){
jawab[b[idx2]] = haha;
sudah[b[idx2]] = true;
haha--;
idx2--;
}
}else{
while(!sudah[a[idx1]] && idx1 > -1){
jawab[a[idx1]] = haha;
sudah[a[idx1]] = true;
haha--;
idx1--;
}
}
for(int i = 1; i <= 6; i++){
W[jawab[i] - 1] = i;
}
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |