# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
765651 | boyliguanhan | Scales (IOI15_scales) | C++17 | 1 ms | 244 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"
#define x(a,b,c) if(a==c) swap(b,c);
void init(int T) {}
void swap(int &a, int &b) {
a+=b;
b=a-b;
a-=b;
}
void orderCoins(){
int a=getLightest(1,2,3);
int f=getHeaviest(4,5,6);
int b=1+(a==1),c=2+(a<=2);
int d=4+(f==4),e=5+(f<=5);
int a2=getLightest(a,d,e);
x(a2,a,d)
x(a2,a,e)
int f2=getHeaviest(f,b,c);
x(f2,f,b)
x(f2,f,c)
int b2=getLightest(b,c,d);
x(b2,b,c)
x(b2,b,d)
x(getLightest(b,d,e),b,e)
int e2=getHeaviest(c,d,e);
x(e2,e,c)
x(e2,e,d);
x(getLightest(c,d,e),c,d);
int w[]={a,b,c,d,e,f};
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |