제출 #433912

#제출 시각아이디문제언어결과실행 시간메모리
433912AugustinasJucas자동 인형 (IOI18_doll)C++14
컴파일 에러
0 ms0 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; int m; vector<int> eil; const int dydis = 800000 + 1100; int state[dydis] = {}; int X[dydis]; int Y[dydis]; int n; int dbInd = 0; int closestPower(int a){ for(int i = a+1; i <= a * 3 + 2; i++){ if(__builtin_popcount(i) == 1) return i; } return -1; } int dfs(int v){ if(v >= n){ int ret = 0; if(dbInd == (int)eil.size()) { ret = -1; }else{ ret = eil[dbInd++]; } //cout << "dabar " << ret << "\n"; return ret; }else{ int sk = dfs(v*2 + state[v]); if(state[v] == 0) X[v-1] = sk; else Y[v-1] = sk; state[v] = !state[v]; return -v; } } void create_circuit(int M, vector<int> A) { if(A.size() == 0) { while(true){ int a; for( ; ; ){}; } 4 /= 0; answer({0}, {}, {}); return; } eil = A; vector<int> C(M+1, -1); C[0] = -1; n = closestPower(A.size()); //cout << "n = " << n << endl; for(int i = 0; i < n; i++) dfs(1); vector<int> XX; for(int i = 0; i < n-1; i++){ XX.push_back(X[i]); //cout << -(i+1) << " x-as yra " << X[i] << endl; } vector<int> YY; for(int i = 0; i < n-1; i++) { YY.push_back(Y[i]); //cout << -i - 1 << " y-as yra " << Y[i] << endl; } YY[YY.size()-1] = 0; // cout << "arciausias " << A.size() << " laipsnis yra " << n << endl; answer(C, XX, YY); return ; } /* 5 8 1 2 2 3 2 4 5 4 */

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

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:40:8: warning: unused variable 'a' [-Wunused-variable]
   40 |    int a; for( ; ; ){};
      |        ^
doll.cpp:42:7: warning: division by zero [-Wdiv-by-zero]
   42 |   } 4 /= 0;
      |     ~~^~~~
doll.cpp:42:10: error: lvalue required as left operand of assignment
   42 |   } 4 /= 0;
      |          ^