제출 #1246601

#제출 시각아이디문제언어결과실행 시간메모리
1246601santi3223저울 (IOI15_scales)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; #define ll long long #define vb vector<bool> #define pb push_back #define ff(aa, bb, cc) for(int aa = bb; aa < cc; aa++) #define vl vector<ll> #define pll pair<ll, ll> #define fi first #define se second #define ed "\n" #define all(aaa) aaa.begin(), aaa.end() #define rall(aaa) aaa.rbegin(), aaa.rend() ll MOD = 1e9+7; /* vector<int> respuesta, cur; int getHeaviest(int A, int B, int C){ A--; B--; C--; if(cur[A] > cur[B] && cur[A] > cur[C]){ return A+1; } if(cur[C] > cur[B] && cur[C] > cur[A]){ return C+1; } return B+1; } int getLightest(int A, int B, int C){ A--; B--; C--; if(cur[A] < cur[B] && cur[A] < cur[C]){ return A+1; } if(cur[C] < cur[B] && cur[C] < cur[A]){ return C+1; } return B+1; } int getMedian(int A, int B, int C){ A--; B--; C--; if((cur[A] < cur[B] && cur[B] < cur[C]) || (cur[C] < cur[B] && cur[B] < cur[A])){ return B+1; } if((cur[B] < cur[A] && cur[A] < cur[C]) || (cur[C] < cur[A] && cur[A] < cur[B])){ return A+1; } return C+1; } void answer(vector<int> r){ /*ff(i, 0, 6){ cout << r[i] << " "; } cout << ed;*/ respuesta = r; } void init(int T) { //nada } */ void orderCoins() { ll h1 = getHeaviest(1, 2, 3); ll h2 = getHeaviest(h1, 4, 5); ll a = 1; if(h2 == 1){ a = 2; } ll h3 = getHeaviest(h2, a, 6); vector<int> ans; vb used(10, false); ans.pb(h3); used[h3] = true; //Hallamos 1, la mas pesada //cout << h3 << ed; //answer({0, 0, 0, 0, 0, (int)h3}); vl coins; //cout << "1-COINS "; ff(i, 1, 7){ if(!used[i]){ //cout << i << " "; coins.pb(i); } } //cout << ed; h1 = getHeaviest(coins[0], coins[1], coins[2]); h2 = getHeaviest(h1, coins[3], coins[4]); ans.pb(h2); //Ya tenemos la 2da mas pesada; //cout << ans[1] << ed; used[h2] = true; //answer({0, 0, 0, 0, ans[1], ans[0]}); coins.clear(); //cout << "2-COINS "; ff(i, 1, 7){ if(!used[i]){ //cout << i << " "; coins.pb(i); } } //cout << ed; h1 = getHeaviest(coins[0], coins[1], coins[2]); if(h1 == coins[0]){ //cout << "C1" << ed; h2 = getHeaviest(coins[3], h1, coins[2]); } else if(h1 == coins[1]){ //cout << "C2" << ed; h2 = getHeaviest(coins[3], h1, coins[2]); } else if(h1 == coins[2]){ //cout << "C3" << ed; h2 = getHeaviest(coins[3], h1, coins[1]); } ans.pb(h2); used[h2] = true; //Ya tenemos la 3ra mas pesada; //cout << ans[2] << ed; //answer({0, 0, 0, ans[2], ans[1], ans[0]}); coins.clear(); //cout << "3-COINS "; ff(i, 1, 7){ if(!used[i]){ //cout << i << " "; coins.pb(i); } } //cout << ed << ed; h1 = getHeaviest(coins[0], coins[1], coins[2]); ans.pb(h1); used[h1] = true; //Ya tenemos la 4ta; //cout << ans[3] << ed; //answer({0, 0, ans[3], ans[2], ans[1], ans[0]}); h1 = getMedian(coins[0], coins[1], coins[2]); ans.pb(h1); used[h1] = true; //La 5ta; //cout << ans[4] << ed; //answer({0, ans[4], ans[3], ans[2], ans[1], ans[0]}); ff(i, 1, 7){ if(!used[i]){ ans.pb(i); break; } } //6ta //cout << ans[5] << ed; reverse(all(ans)); answer(ans); return; } /* int main() { ll T; cin >> T; init(T); while(T--){ ll N = 6; cur = vector<int>(N); vector<int> input; ff(i, 0, N){ int x; cin >> x; input.pb(x); x--; cur[x] = i+1; } orderCoins(); if(input != respuesta){ cout << "Original "; ff(i, 0, N){ cout << input[i] << " "; } cout << ed; cout << "Respuesta "; ff(i, 0, N){ cout << respuesta[i] << " "; } cout << ed << ed; } } return 0; } */

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

scales.cpp:63:9: error: 'respuesta' does not name a type
   63 |         respuesta = r;
      |         ^~~~~~~~~
scales.cpp:64:1: error: expected declaration before '}' token
   64 | }
      | ^
scales.cpp:69:2: error: expected unqualified-id before '/' token
   69 | */
      |  ^