Submission #1037128

#TimeUsernameProblemLanguageResultExecution timeMemory
1037128HappyCapybaraMechanical Doll (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); }

Compilation message (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...