제출 #603288

#제출 시각아이디문제언어결과실행 시간메모리
603288StrawHatWess저울 (IOI15_scales)C++17
55.56 / 100
1 ms468 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 a=getLightest(1,2,3), x=getLightest(4,5,6); int b; ROF(i,1,4) if(i!=a) b=i; int c; ROF(i,1,4) if(i!=a && i!=b) c=i; int y; ROF(i,4,7) if(i!=x) y=i; int z; ROF(i,4,7) if(i!=x && i!=y) z=i; int k=getNextLightest(b,c,x,a); vi order; if(k==x){ int l=getMedian(k,b,c); int m=b; if(l==b) m=c; order={a,k,l,m}; } else{ if(k==c) swap(b,c); int l=getMedian(b,c,x); if(l==b) order={x,a,b,c}; else if(l==x) order={a,b,x,c}; else order={a,b,c,x}; } a=order[0], b=order[1], c=order[2]; int d=order[3]; k=getNextLightest(a,b,c,y); if(k==b){ order={a,y,b,c,d}; } else if(k==c){ order={a,b,y,c,d}; } else{ k=getMedian(a,d,y); if(k==y) order={a,b,c,y,d}; else order={a,b,c,d,y}; } a=order[0], b=order[1], c=order[2], d=order[3]; int e=order[4]; k=getNextLightest(a,b,c,z); if(k==b){ order={a,z,b,c,d,e}; } else if(k==c){ order={a,b,z,c,d,e}; } else{ k=getNextLightest(a,d,e,z); if(k==d) order={a,b,c,z,d,e}; else if(k==e) order={a,b,c,d,z,e}; else order={a,b,c,d,e,z}; } int W[] = {order[0], order[1], order[2], order[3], order[4], order[5]}; answer(W); }

컴파일 시 표준 에러 (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:71:11: warning: 'z' may be used uninitialized in this function [-Wmaybe-uninitialized]
   71 |      order={a,z,b,c,d,e};
      |      ~~~~~^~~~~~~~~~~~~~
scales.cpp:34:21: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized]
   34 |      int l=getMedian(k,b,c);
      |            ~~~~~~~~~^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...