제출 #785232

#제출 시각아이디문제언어결과실행 시간메모리
785232alexander707070저울 (IOI15_scales)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "scales.h" using namespace std; int w[10],z[10],s[10],ans[6]; bool used[10]; void init(int T) { } void orderCoins() { /* ... */ for(int i=1;i<=6;i++){ used[i]=false; } int a=getLightest(1,2,3); int b=getLightest(4,5,6); if(a>1 and b>1)c=getLightest(a,b,1); else if(a<6 and b<6)c=getLightest(a,b,6); else c=getLightest(a,b,2); w[1]=c; if(c==a)w[2]=b; else w[2]=a; used[a]=used[b]=true; int pt=0; for(int i=1;i<=6;i++){ if(!used[i]){ pt++; z[pt]=i; } } int d=getHeaviest(z[1],z[2],a); int e=getHeaviest(z[3],z[4],b); int f=getHeaviest(d,e,a); w[6]=f; if(f==d)w[5]=e; else w[5]=d; used[d]=used[e]=true; pt=0; for(int i=1;i<=6;i++){ if(!used[i]){ pt++; s[pt]=i; } } int x=getMedian(s[1],s[2],a); if(x==s[1]){ w[3]=s[1]; w[4]=s[2]; }else{ w[3]=s[2]; w[4]=s[1]; } for(int i=0;i<6;i++){ ans[i]=w[i+1]; } answer(ans); return; }

컴파일 시 표준 에러 (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:22:20: error: 'c' was not declared in this scope
   22 |     if(a>1 and b>1)c=getLightest(a,b,1);
      |                    ^
scales.cpp:23:25: error: 'c' was not declared in this scope
   23 |     else if(a<6 and b<6)c=getLightest(a,b,6);
      |                         ^
scales.cpp:24:10: error: 'c' was not declared in this scope
   24 |     else c=getLightest(a,b,2);
      |          ^
scales.cpp:26:10: error: 'c' was not declared in this scope
   26 |     w[1]=c;
      |          ^