Submission #1120502

#TimeUsernameProblemLanguageResultExecution timeMemory
1120502epicci23Scales (IOI15_scales)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #include "scales.h" //#define int long long #define all(v) v.begin() , v.end() #define sz(a) (int)a.size() using namespace std; void init(int T){ } void orderCoins(){ array<int,3> a,b; set<int> s; for(int i=1;i<=3;i++) s.insert(i); a[2] = getHeaviest(1, 2, 3); a[0] = getLightest(1, 2, 3); s.erase(a[2]);s.erase(a[0]); a[1] = *s.begin(); s.erase(a[1]); for(int i=4;i<=6;i++) s.insert(i); b[2] = getHeaviest(4, 5, 6); b[0] = getLightest(4, 5, 6); s.erase(b[2]);s.erase(b[0]); b[1] = *s.begin(); s.erase(b[1]); int p1 = 0 , p2 = 0 , p3 = 0; vector<int> W(6, 0); int u = getLightest(a[0], b[0], a[1]); if(u == a[0]) W[p3++] = a[p1++]; else W[p3++] = b[p2++]; while(p1 < 3 && p2 < 3){ int u = getMedian(W[0] , a[p1] , b[p2]); if(u == a[p1]) W[p3++] = a[p1++]; else W[p3++] = b[p2++]; } while(p1 < 3) W[p3++] = a[p1++]; while(p2 < 3) W[p3++] = b[p2++]; answer(W); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:8:15: warning: unused parameter 'T' [-Wunused-parameter]
    8 | void init(int T){
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:38:8: warning: declaration of 'u' shadows a previous local [-Wshadow]
   38 |    int u = getMedian(W[0] , a[p1] , b[p2]);
      |        ^
scales.cpp:32:7: note: shadowed declaration is here
   32 |   int u = getLightest(a[0], b[0], a[1]);
      |       ^
scales.cpp:46:10: error: cannot convert 'std::vector<int>' to 'int*'
   46 |   answer(W);
      |          ^
      |          |
      |          std::vector<int>
In file included from scales.cpp:2:
scales.h:10:17: note:   initializing argument 1 of 'void answer(int*)'
   10 | void answer(int W[]);
      |             ~~~~^~~