Submission #140422

#TimeUsernameProblemLanguageResultExecution timeMemory
140422arthurconmyMechanical Doll (IOI18_doll)C++14
0 / 100
4 ms2636 KiB
#include <bits/stdc++.h> #ifndef ARTHUR_LOCAL #include "doll.h" #endif using namespace std; const int MAXN=100000; int apps[MAXN]; vector<int> go_to[MAXN]; #ifdef ARTHUR_LOCAL void answer(vector<int> V, vector<int> X, vector<int> Y) { for(auto v:V) cout << v << " "; cout << endl; } #endif void create_circuit(int m, vector<int> A) { int n = A.size(); for(int i=0; i<n-1; i++) { go_to[A[i]].push_back(A[i+1]); } vector<int> C={A[0]}; int switch_no=0; vector<int> X; vector<int> Y; for(int i=1; i<m; i++) { if(go_to[i].empty()) { C.push_back(0); continue; } if(go_to[i].size() == 1) { C.push_back(go_to[i][0]); continue; } // if(go_to[i].size() == 2) // { // switch_no++; // C.push_back(-switch_no); // X.push_back() // } } answer(C,X,Y); } #ifdef ARTHUR_LOCAL int main() { create_circuit(3,{1,2,3}); } #endif

Compilation message (stderr)

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:30:6: warning: unused variable 'switch_no' [-Wunused-variable]
   30 |  int switch_no=0;
      |      ^~~~~~~~~
#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...