Submission #396998

#TimeUsernameProblemLanguageResultExecution timeMemory
396998Andyvanh1Scales (IOI15_scales)C++14
Compilation error
0 ms0 KiB
#include "scales.h" 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: In function 'void orderCoins()':
scales.cpp:5:5: error: 'vi' was not declared in this scope; did you mean 'void'?
    5 |     vi arr1(3);
      |     ^~
      |     void
scales.cpp:6:7: error: expected ';' before 'arr2'
    6 |     vi arr2(3);
      |       ^~~~~
      |       ;
scales.cpp:9:9: error: 'arr1' was not declared in this scope
    9 |         arr1[2] = 3;
      |         ^~~~
scales.cpp:11:9: error: 'arr1' was not declared in this scope
   11 |         arr1[2] = 2;
      |         ^~~~
scales.cpp:13:9: error: 'arr1' was not declared in this scope
   13 |         arr1[2] = 1;
      |         ^~~~
scales.cpp:17:9: error: 'arr1' was not declared in this scope
   17 |         arr1[0] = 3;
      |         ^~~~
scales.cpp:19:9: error: 'arr1' was not declared in this scope
   19 |         arr1[0] = 2;
      |         ^~~~
scales.cpp:21:9: error: 'arr1' was not declared in this scope
   21 |         arr1[0] = 1;
      |         ^~~~
scales.cpp:23:5: error: 'arr1' was not declared in this scope
   23 |     arr1[1] = 6-arr1[0]-arr1[2];
      |     ^~~~
scales.cpp:27:9: error: 'arr2' was not declared in this scope
   27 |         arr2[2] = 4;
      |         ^~~~
scales.cpp:29:9: error: 'arr2' was not declared in this scope
   29 |         arr2[2] = 5;
      |         ^~~~
scales.cpp:31:9: error: 'arr2' was not declared in this scope
   31 |         arr2[2] = 6;
      |         ^~~~
scales.cpp:35:9: error: 'arr2' was not declared in this scope
   35 |         arr2[0] = 4;
      |         ^~~~
scales.cpp:37:9: error: 'arr2' was not declared in this scope
   37 |         arr2[0] = 5;
      |         ^~~~
scales.cpp:39:9: error: 'arr2' was not declared in this scope
   39 |         arr2[0] = 6;
      |         ^~~~
scales.cpp:41:5: error: 'arr2' was not declared in this scope
   41 |     arr2[1] = 15-arr2[0]-arr2[2];
      |     ^~~~
scales.cpp:43:7: error: expected ';' before 'ans'
   43 |     vi ans(6);
      |       ^~~~
      |       ;
scales.cpp:45:9: error: 'ans' was not declared in this scope
   45 |         ans[i] =-1;
      |         ^~~
scales.cpp:48:9: error: 'swap' was not declared in this scope
   48 |         swap(arr1, arr2);
      |         ^~~~
scales.cpp:52:13: error: 'ans' was not declared in this scope
   52 |             ans[arr2[0]-1]=0;
      |             ^~~
scales.cpp:54:13: error: 'ans' was not declared in this scope
   54 |             ans[arr2[0]-1]=1;
      |             ^~~
scales.cpp:58:13: error: 'ans' was not declared in this scope
   58 |             ans[arr2[0]-1]=2;
      |             ^~~
scales.cpp:64:13: error: 'ans' was not declared in this scope
   64 |             ans[arr2[1]-1]=1;
      |             ^~~
scales.cpp:66:13: error: 'ans' was not declared in this scope
   66 |             ans[arr2[1]-1]=2;
      |             ^~~
scales.cpp:70:13: error: 'ans' was not declared in this scope
   70 |             ans[arr2[1]-1]=3;
      |             ^~~
scales.cpp:75:13: error: 'ans' was not declared in this scope
   75 |             ans[arr2[2]-1]=2;
      |             ^~~
scales.cpp:77:13: error: 'ans' was not declared in this scope
   77 |             ans[arr2[2]-1]=3;
      |             ^~~
scales.cpp:81:13: error: 'ans' was not declared in this scope
   81 |             ans[arr2[2]-1]=4;
      |             ^~~
scales.cpp:83:9: error: 'set' was not declared in this scope
   83 |         set<int> vals;
      |         ^~~
scales.cpp:83:13: error: expected primary-expression before 'int'
   83 |         set<int> vals;
      |             ^~~
scales.cpp:85:13: error: 'vals' was not declared in this scope
   85 |             vals.insert(i);
      |             ^~~~
scales.cpp:88:13: error: 'vals' was not declared in this scope
   88 |             vals.erase(vals.find(ans[arr2[i]-1]));
      |             ^~~~
scales.cpp:88:34: error: 'ans' was not declared in this scope
   88 |             vals.erase(vals.find(ans[arr2[i]-1]));
      |                                  ^~~
scales.cpp:91:23: error: 'vals' was not declared in this scope
   91 |         for(auto it = vals.begin();it!=vals.end(); it++ ){
      |                       ^~~~
scales.cpp:92:13: error: 'ans' was not declared in this scope
   92 |             ans[arr1[index]-1] = *it;
      |             ^~~
scales.cpp:98:19: error: 'ans' was not declared in this scope; did you mean 'reans'?
   98 |             reans[ans[i]]=i;
      |                   ^~~
      |                   reans
scales.cpp: In function 'void init(int)':
scales.cpp:108:15: warning: unused parameter 'T' [-Wunused-parameter]
  108 | void init(int T){
      |           ~~~~^