Submission #292539

#TimeUsernameProblemLanguageResultExecution timeMemory
292539egekabasMechanical Doll (IOI18_doll)C++14
53 / 100
226 ms18372 KiB
#include "doll.h" #include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define ff first #define ss second #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<ull, ull> pull; typedef pair<int, int> pii; typedef pair<ld, ld> pld; vector<int> g[100009]; int x[400009]; int y[400009]; int n; int curswitch = -1; int create(vector<int> vec, int begin){ if(vec.empty()) return 0; if(vec.size() == 1) return vec[0]; int cur = curswitch; --curswitch; if(begin){ reverse(all(vec)); for(int i = 0; i < 30; ++i) if((1<<i) >= vec.size()){ while(vec.size() < (1<<i)) vec.pb(cur); break; } reverse(all(vec)); } vector<int> v1, v2; for(int i = 0; i < vec.size(); ++i){ if(i%2 == 0) v1.pb(vec[i]); else v2.pb(vec[i]); } x[-(cur+1)] = create(v1, 0); y[-(cur+1)] = create(v2, 0); return cur; } void create_circuit(int M, std::vector<int> A) { n = A.size(); for(int i = 1; i < n; ++i) g[A[i-1]].pb(A[i]); g[A[n-1]].pb(0); g[0].pb(A[0]); vector<int> C(M+1); for(int i = 0; i <= M; ++i){ C[i] = create(g[i], 1); } int switchsize = -(curswitch+1); vector<int> X(switchsize), Y(switchsize); for(int i = 0; i < switchsize; ++i){ X[i] = x[i]; Y[i] = y[i]; } answer(C, X, Y); }

Compilation message (stderr)

doll.cpp: In function 'int create(std::vector<int>, int)':
doll.cpp:29:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             if((1<<i) >= vec.size()){
      |                ~~~~~~~^~~~~~~~~~~~~
doll.cpp:30:34: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |                 while(vec.size() < (1<<i))
      |                       ~~~~~~~~~~~^~~~~~~~
doll.cpp:37:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     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...