제출 #1068623

#제출 시각아이디문제언어결과실행 시간메모리
1068623TheQuantiXMechanical Doll (IOI18_doll)C++17
37 / 100
99 ms8772 KiB
#include <bits/stdc++.h> #include "doll.h" using namespace std; using ll = long long; constexpr ll INF = 1000000000 - 1; ll nxt = -2; void create_circuit(int M, vector<int> A) { ll NN = A.size(); A.push_back(-1); ll N = A.size(); ll ex = 1; while (ex < N) { ex *= 2; } while (A.size() < ex) { A.push_back(-1); } N = A.size(); A[N - 1] = 0; vector<int> C, X, Y; C.push_back(-1); for (int i = 0; i < M; i++) { C.push_back(-1); } X.resize(N - 1); Y.resize(N - 1); for (int i = 1; i < N / 2; i++) { X[i - 1] = -(i * 2); Y[i - 1] = -(i * 2 + 1); } for (int i = N / 2; i <= N - 1; i++) { X[i - 1] = INF; Y[i - 1] = INF; } // for (int i = 0; i < C.size(); i++) { // cout << C[i] << '\n'; // } // cout << conn << '\n'; ll pos = 0, cnt = 0; vector<bool> state(X.size()); // for (int i = 0; i < X.size(); i++) { // cout << X[i] << ' ' << Y[i] << endl; // } do { if (pos >= 0) { pos = C[pos]; } else { if (state[-pos - 1] == 0) { if (X[-pos - 1] == INF) { X[-pos - 1] = A[cnt++]; } state[-pos - 1] = !state[-pos - 1]; pos = X[-pos - 1]; } else { if (Y[-pos - 1] == INF) { Y[-pos - 1] = A[cnt++]; } state[-pos - 1] = !state[-pos - 1]; pos = Y[-pos - 1]; } } } while (pos != 0); // for (int i = 0; i < X.size(); i++) { // cout << '\t' << X[i] << ' ' << Y[i] << endl; // } if (X.size() > NN * 2) { exit(-1); // C[0] = 0; } answer(C, X, Y); }

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

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:19:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   19 |     while (A.size() < ex) {
      |            ~~~~~~~~~^~~~
doll.cpp:72:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   72 |     if (X.size() > NN * 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...