Submission #397004

#TimeUsernameProblemLanguageResultExecution timeMemory
397004Andyvanh1Scales (IOI15_scales)C++14
55.56 / 100
1 ms208 KiB
#include <iostream> #include <vector> #include <algorithm> #include <set> #include "scales.h" using namespace std; typedef long long ll; typedef vector<int> vi; #define vt vector void orderCoins(){ vi arr1(3); vi arr2(3); int x = getHeaviest(1,2,3); if(x==3){ arr1[2] = 3; }else if(x==2){ arr1[2] = 2; }else{ arr1[2] = 1; } int y = getLightest(1,2,3); if(y==3){ arr1[0] = 3; }else if(y==2){ arr1[0] = 2; }else{ arr1[0] = 1; } arr1[1] = 6-arr1[0]-arr1[2]; x = getHeaviest(4,5,6); if(x==4){ arr2[2] = 4; }else if(x==5){ arr2[2] = 5; }else{ arr2[2] = 6; } y = getLightest(4,5,6); if(y==4){ arr2[0] = 4; }else if(y==5){ arr2[0] = 5; }else{ arr2[0] = 6; } arr2[1] = 15-arr2[0]-arr2[2]; x = getHeaviest(arr1[0],arr1[2],arr2[2]); vi ans(6); for(int i = 0; i< 6; i++){ ans[i] =-1; } if(x==arr2[2]) { swap(arr1, arr2); } x = getNextLightest(arr1[0],arr1[1],arr1[2],arr2[0]); if(x==arr1[0]){ ans[arr2[0]-1]=0; }else if(x==arr1[1]){ ans[arr2[0]-1]=1; }else{ ans[arr2[0]-1]=2; } x = getNextLightest(arr1[0],arr1[1],arr1[2],arr2[1]); if(x==arr1[0]){ ans[arr2[1]-1]=1; }else if(x==arr1[1]){ ans[arr2[1]-1]=2; }else{ ans[arr2[1]-1]=3; } x = getNextLightest(arr1[0],arr1[1],arr1[2],arr2[2]); if(x==arr1[0]){ ans[arr2[2]-1]=2; }else if(x==arr1[1]){ ans[arr2[2]-1]=3; }else{ ans[arr2[2]-1]=4; } set<int> vals; for(int i = 0; i < 6; i++){ vals.insert(i); } for(int i = 0; i < 3; i++){ vals.erase(vals.find(ans[arr2[i]-1])); } int index = 0; for(auto it = vals.begin();it!=vals.end(); it++ ){ ans[arr1[index]-1] = *it; index++; } int reans[6]; for(int i = 0; i < 6; i++){ reans[ans[i]]=i+1; } answer(reans); return; } void init(int T){ }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:120:15: warning: unused parameter 'T' [-Wunused-parameter]
  120 | void init(int T){
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...