Submission #33547

#TimeUsernameProblemLanguageResultExecution timeMemory
33547mohammad_kilaniToy Train (IOI17_train)C++14
5 / 100
2000 ms210964 KiB
#include <bits/stdc++.h> #include "train.h" using namespace std; const int N = 5010; int n ; bitset< N > dp[N] , vis[N]; vector<int> g[N] , a , r; bool solve(int i, int j){ if(r[i]) j = n; if(j == 0) return 0; if(vis[i][j]) return dp[i][j]; vis[i][j] = 1; dp[i][j] = 1; if(!a[i]){ for(int k=0;k<g[i].size();k++){ int node = g[i][k]; if(solve(node,j-1) == 0) dp[i][j] = 0; } } else{ bool can = false; for(int k=0;k<g[i].size();k++){ int node = g[i][k]; if(solve(node,j-1) == 1) can = true; } dp[i][j] = can; } return dp[i][j]; } std::vector<int> who_wins(std::vector<int> A, std::vector<int> R, std::vector<int> u, std::vector<int> v) { vector<int> ans; a = A; r = R;; n = a.size(); for(int i=0;i<u.size();i++) g[u[i]].push_back(v[i]); for(int i=0;i<n;i++){ ans.push_back(solve(i,n)); } return ans; }

Compilation message (stderr)

train.cpp: In function 'bool solve(int, int)':
train.cpp:15:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int k=0;k<g[i].size();k++){
                ^
train.cpp:22:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int k=0;k<g[i].size();k++){
                ^
train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:37:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<u.size();i++) g[u[i]].push_back(v[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...