Submission #68248

#TimeUsernameProblemLanguageResultExecution timeMemory
68248TalantToy Train (IOI17_train)C++17
0 / 100
2053 ms24948 KiB
#include "train.h" //#include "grader.cpp" #include <bits/stdc++.h> #define mk make_pair #define sc second #define fr first #define pb push_back using namespace std; const int N = (1e6 + 5); const int inf = (1e9 + 7); int pr[N]; bool f[N]; bool was[N]; vector <int> g[N],res; void dfs (int e,int v) { was[v] = 1; for (auto to : g[v]) { if (!was[to]) { dfs(e,to); } else if (was[to] && to == e) { f[to] = 1,f[v] = 1; } f[v] |= f[to]; } } vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { for (int i = 0; i < u.size(); i ++) g[u[i]].pb(v[i]); for (int i = 0; i < a.size(); i ++) res.pb(0); for (int i = 0; i < r.size(); i ++) { if (r[i]) { for (int j = 0; j < r.size(); j ++) was[j] = 0,f[j] = 0; dfs(i,i); for (int j = 0; j < r.size(); j ++) was[j] = 0; dfs(i,i); for (int j = 0; j < r.size(); j ++) { res[j] |= f[j]; } } } 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:35:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < u.size(); i ++)
                  ~~^~~~~~~~~~
train.cpp:38:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < a.size(); i ++)
                       ~~^~~~~~~~~~
train.cpp:41:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < r.size(); i ++) {
                       ~~^~~~~~~~~~
train.cpp:43:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   for (int j = 0; j < r.size(); j ++)
                                   ~~^~~~~~~~~~
train.cpp:46:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   for (int j = 0; j < r.size(); j ++)
                                   ~~^~~~~~~~~~
train.cpp:49:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   for (int j = 0; j < r.size(); j ++) {
                                   ~~^~~~~~~~~~
#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...