# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31257 | top34051 | 저울 (IOI15_scales) | C++14 | 0 ms | 2024 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"
#include<bits/stdc++.h>
using namespace std;
int A[5], B[5], p[5];
void init(int T) {
}
void orderCoins() {
int i,j,x,pos;
int W[] = {1, 2, 3, 4, 5, 6};
A[0] = getLightest(1,2,3);
A[1] = getMedian(1,2,3);
for(x=1;x<=3;x++) if(x!=A[0] && x!=A[1]) A[2] = x;
B[0] = getLightest(4,5,6);
B[1] = getMedian(4,5,6);
for(x=4;x<=6;x++) if(x!=B[0] && x!=B[1]) B[2] = x;
for(i=0;i<3;i++) {
// if(i && p[i-1]==-1) {
// p[i] = -1;
// continue;
// }
p[i] = getNextLightest(A[0],A[1],A[2],B[i]);
// if(p[i]==A[0] && getLightest(A[0],A[1],B[i])!=B[i]) p[i] = -1;
}
pos = 0;
for(i=j=0;i<3;i++) {
while(j<3 && p[j]==A[i]) W[pos++] = B[j++];
W[pos++] = A[i];
}
while(j<3) W[pos++] = B[j++];
// for(i=0;i<6;i++) cerr << W[i] << " ";
// cerr << endl;
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |