Submission #603170

#TimeUsernameProblemLanguageResultExecution timeMemory
603170StrawHatWessScales (IOI15_scales)C++17
0 / 100
2 ms300 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; #define FOR(i,a,b) for(int i=a; i<b; i++) #define ROF(i,a,b) for(int i=b-1; i>=a; i--) typedef vector<int>vi; #define pb push_back #define sz(x) (int)x.size() #define all(x) begin(x),end(x) //------ void init(int T) { return; } void orderCoins() { int x=getLightest(1,2,3), y=getMedian(1,2,3), z; FOR(i,1,4) if(i!=x && i!=y) z=i; vi a={x,y,z}; x=getLightest(4,5,6), y=getMedian(4,5,6), z; FOR(i,4,7) if(i!=x && i!=y) z=i; vi b={x,y,z}; vi vec={a[0],b[0],a[1],b[1],a[2],b[2]}; vi order; int rep=6; while(rep--){ vi cur; for(int x: vec) if(x!=-1){ cur.pb(x); if(sz(cur)==3) break; } if(!sz(cur)) break; if(sz(cur)==1){ order.pb(cur[0]); } else if(sz(cur)==2){ int k; FOR(i,1,7) if(i!=cur[0] && i!=cur[1]){ k=i; break; } x=getMedian(k,cur[0],cur[1]); order.pb(x); for(int &val: vec) if(val==x){val=-1; break;} } else{ x=getLightest(cur[0],cur[1],cur[2]); order.pb(x); for(int &val: vec) if(val==x){val=-1; break;} } } int W[] = {order[0],order[1],order[2],order[3],order[4],order[5]}; answer(W); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:17:15: warning: unused parameter 'T' [-Wunused-parameter]
   17 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:28:48: warning: right operand of comma operator has no effect [-Wunused-value]
   28 |     x=getLightest(4,5,6), y=getMedian(4,5,6), z;
      |                                                ^
scales.cpp:41:14: warning: declaration of 'x' shadows a previous local [-Wshadow]
   41 |      for(int x: vec) if(x!=-1){
      |              ^
scales.cpp:23:9: note: shadowed declaration is here
   23 |     int x=getLightest(1,2,3), y=getMedian(1,2,3), z;
      |         ^
scales.cpp:57:18: warning: 'k' may be used uninitialized in this function [-Wmaybe-uninitialized]
   57 |       x=getMedian(k,cur[0],cur[1]);
      |         ~~~~~~~~~^~~~~~~~~~~~~~~~~
scales.cpp:26:16: warning: 'z' may be used uninitialized in this function [-Wmaybe-uninitialized]
   26 |     vi a={x,y,z};
      |                ^
#Verdict Execution timeMemoryGrader output
Fetching results...