# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
815092 | kwongweng | Scales (IOI15_scales) | C++17 | 1 ms | 212 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;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef pair<ll, ll> pll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define ms memset
#define pb push_back
#define fi first
#define se second
#define H(a,b,c) getHeaviest(a,b,c)
#define L(a,b,c) getLightest(a,b,c)
#define M(a,b,c) getMedian(a,b,c)
#define NL(a,b,c,d) getNextLightest(a,b,c,d);
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
int mx1 = H(1,2,3);
int mn1 = L(1,2,3);
int md1 = 6-mx1-mn1;
int mx2 = H(4,5,6);
int mn2 = L(4,5,6);
int md2 = 15-mx2-mn2;
vi seq1 = {mn1,md1,mx1};
vi seq2 = {mn2,md2,mx2};
int val = H(mx1,mx2,md1);
vi ans;
if (val==mx2){
int cur=0;
FOR(i,0,3){
int val2 = NL(mn2,md2,mx2,seq1[i]);
if (val2==mn2) ans.pb(seq1[i]);
if (val2==md2){
if (cur==0){ans.pb(mn2); cur++;}
ans.pb(seq1[i]);
}
if (val2==mx2){
if (cur==0){ans.pb(mn2); cur++;}
if (cur==1){ans.pb(md2); cur++;}
ans.pb(seq1[i]);
}
}
if (cur==0){ans.pb(mn2); cur++;}
if (cur==1){ans.pb(md2); cur++;}
ans.pb(mx2);
}else{
int cur=0;
FOR(i,0,3){
int val2 = NL(mn1,md1,mx1,seq2[i]);
if (val2==mn1) ans.pb(seq2[i]);
if (val2==md1){
if (cur==0){ans.pb(mn1); cur++;}
ans.pb(seq2[i]);
}
if (val2==mx1){
if (cur==0){ans.pb(mn1); cur++;}
if (cur==1){ans.pb(md1); cur++;}
ans.pb(seq2[i]);
}
}
if (cur==0){ans.pb(mn1); cur++;}
if (cur==1){ans.pb(md1); cur++;}
ans.pb(mx1);
}
int W[] = {1, 2, 3, 4, 5, 6};
FOR(i,0,6) W[i]=ans[i];
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |