제출 #463719

#제출 시각아이디문제언어결과실행 시간메모리
463719tomsyd자동 인형 (IOI18_doll)C++17
0 / 100
1 ms204 KiB
#include "doll.h" #include<bits/stdc++.h> using namespace std; void create_circuit(int M, vector<int> A) { /* if (M == A.size()){ vector<int> C(M + 1); C[0] = A[0]; int N = A.size(); for (int i = 0; i<N-1; ++i) { C[A[i]] = A[i+1]; } C[A[N-1]] = 0; vector<int> X,Y; answer(C, X, Y); } */ if (M == 1){ int pow2 = 1, N = A.size(); vector<int> C(M+1); if(N == 1){ vector<int> da,db; C[0] = 1; C[1] = 0; answer(C,da,db); return; } while (pow2 < N) pow2 *= 2; pow2 /= 2; vector<int> X(2*pow2-1,-1),Y(2*pow2-1,-1); for (int i=0; i<pow2-1; ++i){ X[i] = -(2*(i+1)); Y[i] = -(2*(i+1)+1); } C[0] = 1; C[1] = -1; int crt = N-1; if (crt > 1){ crt--; X[X.size()-1] = 1; } Y[Y.size()-1] = 0; int idx = X.size()-2; while (crt > 0){ X[idx] = 1; --crt; if (crt > 0){ --crt; Y[idx] = 1; } idx--; } for (int i=0; i<X.size(); ++i){ cout << -i-1 << " : " << X[i] << ' ' << Y[i] << endl; } answer(C,X,Y); } }

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

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:52:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |   for (int i=0; i<X.size(); ++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...