Submission #397000

#TimeUsernameProblemLanguageResultExecution timeMemory
397000Andyvanh1Scales (IOI15_scales)C++14
Compilation error
0 ms0 KiB
#include "scales.h" typedef vector<int> vi; 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; } answer(reans); return; } void init(int T){ }

Compilation message (stderr)

scales.cpp:3:9: error: 'vector' does not name a type
    3 | typedef vector<int> vi;
      |         ^~~~~~
scales.cpp: In function 'void orderCoins()':
scales.cpp:6:5: error: 'vi' was not declared in this scope; did you mean 'void'?
    6 |     vi arr1(3);
      |     ^~
      |     void
scales.cpp:7:7: error: expected ';' before 'arr2'
    7 |     vi arr2(3);
      |       ^~~~~
      |       ;
scales.cpp:10:9: error: 'arr1' was not declared in this scope
   10 |         arr1[2] = 3;
      |         ^~~~
scales.cpp:12:9: error: 'arr1' was not declared in this scope
   12 |         arr1[2] = 2;
      |         ^~~~
scales.cpp:14:9: error: 'arr1' was not declared in this scope
   14 |         arr1[2] = 1;
      |         ^~~~
scales.cpp:18:9: error: 'arr1' was not declared in this scope
   18 |         arr1[0] = 3;
      |         ^~~~
scales.cpp:20:9: error: 'arr1' was not declared in this scope
   20 |         arr1[0] = 2;
      |         ^~~~
scales.cpp:22:9: error: 'arr1' was not declared in this scope
   22 |         arr1[0] = 1;
      |         ^~~~
scales.cpp:24:5: error: 'arr1' was not declared in this scope
   24 |     arr1[1] = 6-arr1[0]-arr1[2];
      |     ^~~~
scales.cpp:28:9: error: 'arr2' was not declared in this scope
   28 |         arr2[2] = 4;
      |         ^~~~
scales.cpp:30:9: error: 'arr2' was not declared in this scope
   30 |         arr2[2] = 5;
      |         ^~~~
scales.cpp:32:9: error: 'arr2' was not declared in this scope
   32 |         arr2[2] = 6;
      |         ^~~~
scales.cpp:36:9: error: 'arr2' was not declared in this scope
   36 |         arr2[0] = 4;
      |         ^~~~
scales.cpp:38:9: error: 'arr2' was not declared in this scope
   38 |         arr2[0] = 5;
      |         ^~~~
scales.cpp:40:9: error: 'arr2' was not declared in this scope
   40 |         arr2[0] = 6;
      |         ^~~~
scales.cpp:42:5: error: 'arr2' was not declared in this scope
   42 |     arr2[1] = 15-arr2[0]-arr2[2];
      |     ^~~~
scales.cpp:44:7: error: expected ';' before 'ans'
   44 |     vi ans(6);
      |       ^~~~
      |       ;
scales.cpp:46:9: error: 'ans' was not declared in this scope
   46 |         ans[i] =-1;
      |         ^~~
scales.cpp:49:9: error: 'swap' was not declared in this scope
   49 |         swap(arr1, arr2);
      |         ^~~~
scales.cpp:53:13: error: 'ans' was not declared in this scope
   53 |             ans[arr2[0]-1]=0;
      |             ^~~
scales.cpp:55:13: error: 'ans' was not declared in this scope
   55 |             ans[arr2[0]-1]=1;
      |             ^~~
scales.cpp:59:13: error: 'ans' was not declared in this scope
   59 |             ans[arr2[0]-1]=2;
      |             ^~~
scales.cpp:65:13: error: 'ans' was not declared in this scope
   65 |             ans[arr2[1]-1]=1;
      |             ^~~
scales.cpp:67:13: error: 'ans' was not declared in this scope
   67 |             ans[arr2[1]-1]=2;
      |             ^~~
scales.cpp:71:13: error: 'ans' was not declared in this scope
   71 |             ans[arr2[1]-1]=3;
      |             ^~~
scales.cpp:76:13: error: 'ans' was not declared in this scope
   76 |             ans[arr2[2]-1]=2;
      |             ^~~
scales.cpp:78:13: error: 'ans' was not declared in this scope
   78 |             ans[arr2[2]-1]=3;
      |             ^~~
scales.cpp:82:13: error: 'ans' was not declared in this scope
   82 |             ans[arr2[2]-1]=4;
      |             ^~~
scales.cpp:84:9: error: 'set' was not declared in this scope
   84 |         set<int> vals;
      |         ^~~
scales.cpp:84:13: error: expected primary-expression before 'int'
   84 |         set<int> vals;
      |             ^~~
scales.cpp:86:13: error: 'vals' was not declared in this scope
   86 |             vals.insert(i);
      |             ^~~~
scales.cpp:89:13: error: 'vals' was not declared in this scope
   89 |             vals.erase(vals.find(ans[arr2[i]-1]));
      |             ^~~~
scales.cpp:89:34: error: 'ans' was not declared in this scope
   89 |             vals.erase(vals.find(ans[arr2[i]-1]));
      |                                  ^~~
scales.cpp:92:23: error: 'vals' was not declared in this scope
   92 |         for(auto it = vals.begin();it!=vals.end(); it++ ){
      |                       ^~~~
scales.cpp:93:13: error: 'ans' was not declared in this scope
   93 |             ans[arr1[index]-1] = *it;
      |             ^~~
scales.cpp:99:19: error: 'ans' was not declared in this scope; did you mean 'reans'?
   99 |             reans[ans[i]]=i;
      |                   ^~~
      |                   reans
scales.cpp: In function 'void init(int)':
scales.cpp:109:15: warning: unused parameter 'T' [-Wunused-parameter]
  109 | void init(int T){
      |           ~~~~^