Submission #1032730

#TimeUsernameProblemLanguageResultExecution timeMemory
1032730parsadox2Mechanical Doll (IOI18_doll)C++17
53 / 100
115 ms19352 KiB
#include <bits/stdc++.h> #include "doll.h" using namespace std; const int N = 2e5 + 10; int n , m; vector <int> C , X , Y , adj[N]; int Solve(vector <int> vec) { if(vec.size() == 1) return vec[0]; X.push_back(0); Y.push_back(0); int now = X.size(); vector <int> v[2]; if(vec.size() % 2 == 1) { vec.push_back(-now); swap(vec[vec.size() - 1] , vec[vec.size() - 2]); } for(int i = 0 ; i < vec.size() ; i++) v[i % 2].push_back(vec[i]); X[now - 1] = Solve(v[0]); Y[now - 1] = Solve(v[1]); return -now; } void Build(int v) { //cout << "WTF " << endl; if(adj[v].empty()) { C[v] = 0; return; } /*cout << "HI " << endl; cout << Solve(adj[v]) << endl; cout << "WETRW RW REWE " << endl;*/ C[v] = Solve(adj[v]); /*cout << C[v] << endl; cout << "BYE " << endl;*/ } void create_circuit(int mm , vector <int> A) { n = A.size(); m = mm; C.resize(m + 1); adj[0].push_back(A[0]); for(int i = 0 ; i + 1 < n ; i++) adj[A[i]].push_back(A[i + 1]); adj[A.back()].push_back(0); for(int i = 0 ; i <= m ; i++) { //cout << i << " : " << endl; Build(i); } answer(C , X , Y); }

Compilation message (stderr)

doll.cpp: In function 'int Solve(std::vector<int>)':
doll.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for(int i = 0 ; i < vec.size() ; i++)
      |                  ~~^~~~~~~~~~~~
#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...