제출 #1121094

#제출 시각아이디문제언어결과실행 시간메모리
1121094epicci23저울 (IOI15_scales)C++17
컴파일 에러
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; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); int go[10]; void init(int T){ vector<int> perm(6,0); iota(all(perm),0); shuffle(all(perm),rng); for(int i = 1 ; i <= n ; i++) go[i] = perm[i - 1] + 1; } void orderCoins(){ vector<int> cur; int med = getMedian(go[1],go[2],go[3]); int D = getNextLightest(go[1],go[2],go[3],go[4]); vector<int> kal; for(int i = 1 ; i <= 3 ; i++) kal.push_back(go[i]); for(int i=0;i<3;i++){ if(kal[i] == med){ kal.erase(kal.begin() + i); break; } } if(D == med){ int lol = getLightest(kal[0],kal[1],go[4]); if(lol == kal[0]){ cur.push_back(kal[0]); cur.push_back(go[4]); cur.push_back(med); cur.push_back(kal[1]); } else{ cur.push_back(kal[1]); cur.push_back(go[4]); cur.push_back(med); cur.push_back(kal[0]); } } else{ int mini = getLightest(kal[0], kal[1], go[4]); if(mini == go[4]){ cur.push_back(go[4]); cur.push_back(D); cur.push_back(med); if(kal[0] == D) cur.push_back(kal[1]); else cur.push_back(kal[0]); } else if(mini == D){ cur.push_back(mini); cur.push_back(med); if(kal[0] == D) cur.push_back(kal[1]); else cur.push_back(kal[0]); cur.push_back(go[4]); } else{ cur.push_back(mini); cur.push_back(med); cur.push_back(go[4]); if(kal[0] == mini) cur.push_back(kal[1]); else cur.push_back(kal[0]); } } // 5 ekle int u = getMedian(cur[0], go[5], cur[3]); if(u == cur[0]) cur.insert(cur.begin(),go[5]); else if(u == cur[3]) cur.push_back(go[5]); else{ int u2 = getMedian(cur[1],go[5],cur[2]); if(u2 == cur[1]) cur.insert(cur.begin()+1,go[5]); else if(u2 == go[5]) cur.insert(cur.begin()+2,go[5]); else cur.insert(cur.begin()+3,go[5]); } // 6 ekle u = getMedian(cur[0],go[6],cur[3]); if(u == cur[0]) cur.insert(cur.begin(),go[6]); else if(u == cur[3]){ int u2 = getMedian(cur[3],go[6],cur[4]); if(u2 == cur[4]) cur.push_back(go[6]); else cur.insert(cur.begin()+4,go[6]); } else{ int u2 = getMedian(cur[1],go[6],cur[2]); if(u2 == go[6]) cur.insert(cur.begin()+2,go[6]); else if(u2 == cur[1]) cur.insert(cur.begin() + 1, go[6]); else cur.insert(cur.begin() + 3 , go[6]); } int W[6]; for(int i = 0 ; i < 6 ; i++) W[i] = cur[i]; answer(W); }

컴파일 시 표준 에러 (stderr) 메시지

scales.cpp: In function 'void init(int)':
scales.cpp:15:24: error: 'n' was not declared in this scope
   15 |   for(int i = 1 ; i <= n ; i++) go[i] = perm[i - 1] + 1;
      |                        ^
scales.cpp:11:15: warning: unused parameter 'T' [-Wunused-parameter]
   11 | void init(int T){
      |           ~~~~^