Submission #94980

#TimeUsernameProblemLanguageResultExecution timeMemory
94980someone_aaMechanical Doll (IOI18_doll)C++17
6 / 100
93 ms10972 KiB
#include <bits/stdc++.h> #include "doll.h" #define pb push_back #define mp make_pair using namespace std; const int maxm = 100100; vector<int> after[maxm]; void create_circuit(int M, std::vector<int> A) { int N = A.size(); std::vector<int> C(M + 1, 0); C[0] = A[0]; for(int i=1;i<A.size();i++) { after[A[i-1]].pb(A[i]); } after[A.back()].pb(0); vector<int> X, Y; int br = 1; for(int i=1;i<=M;i++) { if(after[i].size() == 0) continue; else if(after[i].size() == 1) { C[i] = after[i][0]; } else { C[i] = -br; X.pb(after[i][0]); Y.pb(after[i][1]); br++; } } /*for (int k = 0; k < N; ++k) { X[k] = Y[k] = A[k]; }*/ answer(C, X, Y); }

Compilation message (stderr)

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