# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
407124 | MDario | Scales (IOI15_scales) | C++11 | 1 ms | 204 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;
typedef long long ll;
#define F first
#define S second
void init(int T) {
return ;
}
void orderCoins() {
/* ... */
int w[] = {1, 2, 3, 4, 5, 6}, c;
vector<int> v1, v2;
c=6;
v1.push_back(getLightest(1, 2, 3));
c-=v1.back();
v1.push_back(getMedian(1, 2, 3));
c-=v1.back();
v1.push_back(c);
c=4+5+6;
v2.push_back(getLightest(4, 5, 6));
c-=v2.back();
v2.push_back(getMedian(4, 5, 6));
c-=v2.back();
v2.push_back(c);
int c1=0, c2=0;
while(c1<=2||c2<=2){
if(c1>c2){
swap(c1, c2);
swap(v1, v2);
}
if(c2==3){
for(int i=c1; i<=2; i++){
w[c2+c1]=v1[c1];
c1++;
}
}
else if(c1<=1){
c=getMedian(v1[c1], v2[c2], v1[c1+1]);
if(c==v1[c1]){
w[c1+c2]=v2[c2];
c2++;
}
else if(c==v1[c1+1]){
w[c1+c2]=v1[c1];
c1++;
w[c1+c2]=v1[c1];
c1++;
}
else{
w[c1+c2]=v1[c1];
c1++;
w[c1+c2]=v2[c2];
c2++;
}
}
else if(c1==2&&c2==2){
c=getHeaviest(v1[c1], v2[c2], v1[c1-1]);
if(c==v1[c1]){
w[c1+c2]=v2[c2];
c2++;
w[c1+c2]=v1[c1];
c1++;
}
else{
w[c1+c2]=v1[c1];
c1++;
w[c1+c2]=v2[c2];
c2++;
}
}
}
answer(w);
return ;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |