제출 #75282

#제출 시각아이디문제언어결과실행 시간메모리
75282KieranHorgan자동 인형 (IOI18_doll)C++17
37 / 100
170 ms13296 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; pair<int, int> exits[400005]; vector<int> X, Y; int nodeIdx = 1; vector<int> dep[300]; int build(vector<int> cur) { if(cur.size() == 1) { return cur[0]; } int curNode = nodeIdx++; vector<int> nextCur; for(int i = 0; i < cur.size(); i+=2) { nextCur.push_back(cur[i]); } exits[curNode].first = build(nextCur); nextCur.clear(); for(int i = 1; i < cur.size(); i+=2) { nextCur.push_back(cur[i]); } exits[curNode].second = build(nextCur); nextCur.clear(); return -curNode; } void create_circuit(int M, vector<int> A) { int N = A.size(); while(__builtin_popcount(A.size()+1) != 1) { A.push_back(-1); } A.push_back(0); // cerr << A.size() << endl; vector<int> C(M + 1); C[0] = -1; for (int i = 1; i <= M; ++i) { C[i] = -1; } vector<int> cur; for(int i = 0; i < A.size(); i++) { cur.push_back(A[i]); } cur.back() = -cur.back(); build(cur); for(int i = 1; i < nodeIdx; i++) { X.push_back(exits[i].first); Y.push_back(exits[i].second); } // cerr << N << " -> " << X.size() << " (" << N + log2(N) << ")" << endl; // double score; // if(X.size() <= N + log2(N)) score = 100; // else if(X.size() > 2*N) score = 0; // else score = 100*(0.5 + 0.4 * ( (2*N - X.size()) / (N - log2(N)) ) * ( (2*N - X.size()) / (N - log2(N)) )); // cerr << "Score: " << score << endl; if(X.size() > N*2) exit(-1); answer(C, X, Y); }

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

doll.cpp: In function 'int build(std::vector<int>)':
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 = 0; i < cur.size(); i+=2) {
      |                  ~~^~~~~~~~~~~~
doll.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   for(int i = 1; i < cur.size(); i+=2) {
      |                  ~~^~~~~~~~~~~~
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:46:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |   for(int i = 0; i < A.size(); i++) {
      |                  ~~^~~~~~~~~~
doll.cpp:65:15: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   65 |   if(X.size() > N*2)
      |      ~~~~~~~~~^~~~~
#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...