제출 #418264

#제출 시각아이디문제언어결과실행 시간메모리
418264FlippenFazMechanical Doll (IOI18_doll)C++11
2 / 100
55 ms7884 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<int> c; vector<int> x; vector<int> y; vector<vector<int>> cons; void answer(vector<int> one, vector<int> two, vector<int> three); void connect(int start, int end) { if (c[start] == 0) { c[start] = end; } else if (c[start] > 0) { x.push_back( c[start] ); y.push_back( end ); c[start] = -x.size(); } else { } } void create_circuit(int m, vector<int> a) { cons.resize(m+1); c.resize(m+1); int prev = 0; for (int i = 0; i < a.size(); i++) { cons[prev].push_back(a[i]); prev = a[i]; } for (int i = 0; i < cons.size(); i++) { //cout << "I IS: " << i << endl; //cout << "CON SIZE IS: " << cons[i].size() << endl; if (cons[i].size() == 0) { c[i] = 0; } else if (cons[i].size() == 1) { c[i] = cons[i][0]; } else { //cout << "CUR I: " << i; int offset = -x.size(); c[i] = offset - 1; int added = pow(2,ceil(log2(cons[i].size()))) - 1; //cout << "ADDED: " << added; for (int j = 1; j < added+1; j++) { x.push_back( offset -j*2 ); y.push_back( offset -j*2 - 1); } //cout << "HERE" << endl; int last = added/2+1; int start = x.size()-last; int cnt = 0; for (int j = start; j < x.size(); j++) { x[j] = -j-1; y[j] = cons[i][cnt++]; } for (int j = start; cnt < cons[i].size(); j++) { x[j] = y[j]; y[j] = cons[i][cnt++]; } } } answer(c, x, y); } int M, N; int temp; vector<int> inp;

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

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:32:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for (int i = 0; i < a.size(); i++) {
      |                     ~~^~~~~~~~~~
doll.cpp:37:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for (int i = 0; i < cons.size(); i++) {
      |                     ~~^~~~~~~~~~~~~
doll.cpp:60:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |             for (int j = start; j < x.size(); j++) {
      |                                 ~~^~~~~~~~~~
doll.cpp:64:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |             for (int j = start; cnt < cons[i].size(); j++) {
      |                                 ~~~~^~~~~~~~~~~~~~~~
#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...