제출 #75292

#제출 시각아이디문제언어결과실행 시간메모리
75292KieranHorgan자동 인형 (IOI18_doll)C++17
37 / 100
167 ms12920 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; vector<int> A, X, Y, C; int dep[200]; int nextTrigger = -1; int solve(vector<int> a, int d) { if(a.size() == 1) return a[0]; int trigger = nextTrigger--; vector<int> b; dep[d]++; for(int i = 0; i < a.size(); i+=2) b.push_back(a[i]); int l = solve(b, d+1); b.clear(); for(int i = 1; i < a.size(); i+=2) b.push_back(a[i]); int r = solve(b, d+1); b.clear(); if(-(trigger+1) >= X.size()) X.resize(-(trigger)), Y.resize(-(trigger)); X[-(trigger+1)] = l; Y[-(trigger+1)] = r; return trigger; } void create_circuit(int M, vector<int> A_) { A = A_; int N = A.size(); while(__builtin_popcount(A.size()+1) != 1) { A.push_back(-1); } A.push_back(0); C.assign(M+1, -1); solve(A, 1); // cerr << nextTrigger << endl; // for(int i = 1; dep[i]; i++) // cerr << i << ": " << dep[i] << endl; // // cerr << N << " " << X.size() << endl; answer(C, X, Y); }

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

doll.cpp: In function 'int solve(std::vector<int>, int)':
doll.cpp:13:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |   for(int i = 0; i < a.size(); i+=2)
      |                  ~~^~~~~~~~~~
doll.cpp:17:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   for(int i = 1; i < a.size(); i+=2)
      |                  ~~^~~~~~~~~~
doll.cpp:22:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   if(-(trigger+1) >= X.size())
      |      ~~~~~~~~~~~~~^~~~~~~~~~~
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:31:7: warning: unused variable 'N' [-Wunused-variable]
   31 |   int N = A.size();
      |       ^
#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...