제출 #1037128

#제출 시각아이디문제언어결과실행 시간메모리
1037128HappyCapybara자동 인형 (IOI18_doll)C++17
16 / 100
52 ms12864 KiB
#include "doll.h" #include<bits/stdc++.h> using namespace std; void create_circuit(int M, vector<int> A) { vector<vector<int>> v(M+1); A.push_back(0); for (int i=0; i<A.size()-1; i++) v[A[i]].push_back(A[i+1]); v[0].push_back(A[0]); vector<int> C(M+1, 0); vector<int> X, Y; for (int i=0; i<=M; i++){ if (v[i].size() == 0) continue; if (v[i].size() == 1) C[i] = v[i][0]; if (v[i].size() == 2){ X.push_back(v[i][0]); Y.push_back(v[i][1]); C[i] = -X.size(); } if (v[i].size() == 3){ int cur = X.size(); C[i] = -(cur+1); X.push_back(-(cur+2)); Y.push_back(-(cur+3)); X.push_back(v[i][0]); Y.push_back(-(cur+1)); X.push_back(v[i][1]); Y.push_back(v[i][2]); } if (v[i].size() == 4){ int cur = X.size(); C[i] = -(cur+1); X.push_back(-(cur+2)); Y.push_back(-(cur+3)); X.push_back(v[i][0]); Y.push_back(v[i][2]); X.push_back(v[i][1]); Y.push_back(v[i][3]); } } answer(C, X, Y); }

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

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