제출 #95669

#제출 시각아이디문제언어결과실행 시간메모리
95669shenxy자동 인형 (IOI18_doll)C++11
0 / 100
26 ms2212 KiB
#include <algorithm> #include "doll.h" #include <vector> using namespace std; int num_bits_in(int N) { int ans = 0; while (N != 0) { ans += 1; N = N >> 1; } return ans; } void create_circuit(int M, vector<int> A) { if (M == 1) { int evilnum = A.size() - 1; vector<int> C(2); C[0] = 1; C[1] = -1; vector<int> X(num_bits_in(A.size() - 1), 1), Y(num_bits_in(A.size() - 1), 1); for (int i = 0; i < X.size() - 1; i++) { if (evilnum & (1 << i)) Y[i] = 0 - (i + 2); else X[i] = 0 - (i + 2); } if (evilnum & (1 << (X.size() - 1))) Y[X.size() - 1] = 0; else X[X.size() - 1] = 0; answer(C, X, Y); return; } int N = A.size(); vector<int> exits(M + 1, 0); int ptr = 0; for (int i = 0; i < N; i++) { exits[ptr] = A[i]; ptr = A[i]; } answer(exits, {}, {}); }

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

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:20:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |   for (int i = 0; i < X.size() - 1; i++) {
      |                   ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...