Submission #783447

#TimeUsernameProblemLanguageResultExecution timeMemory
783447boyliguanhanToy Train (IOI17_train)C++17
5 / 100
4 ms856 KiB
#include "train.h" #include<bits/stdc++.h> using namespace std; std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { std::vector<int> res(a.size(),0); res.back() = r.back(); int x[r.size()]; memset(x, 0, sizeof x); for(int i = 0; i < u.size(); i++) { x[u[i]]+=1<<v[i]-u[i]; } for(int i = a.size()-1; i--;) { if(a[i]) { if(x[i]%2&&r[i]) res[i] = 1; else if(x[i]>1&&res[i+1]) res[i] = 1; } else { if(x[i]%2&&!r[i]) res[i] = 0; else if(x[i]>1&&!res[i+1])res[i] = 0; else res[i] = 1; } } return res; }

Compilation message (stderr)

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:9:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i = 0; i < u.size(); i++) {
      |                    ~~^~~~~~~~~~
train.cpp:10:25: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   10 |         x[u[i]]+=1<<v[i]-u[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...