Submission #68398

#TimeUsernameProblemLanguageResultExecution timeMemory
68398TalantToy Train (IOI17_train)C++17
0 / 100
2037 ms80828 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]; int ed[5005][5005]; bool f[N]; bool was[N]; vector <int> g[N]; vector <int> res; deque <int> cur; void dfs (int e,int v) { was[v] = 1; cur.pb(v); for (auto to : g[v]) { if (!was[to]) { if (ed[v][to] && ed[to][v]) { if (v == e) f[v] = 1; f[to] |= f[v]; } dfs(e,to); } if (f[to] || to == e) { f[e] = 1; for (int i = cur.size() - 1; i >= 0; i --) { if (f[cur[i]]) break; f[cur[i]] = 1; } } } cur.pop_back(); } 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]); ed[u[i]][v[i]] = 1; } for (int i = 0; i < a.size(); i ++) res.pb(0); for (int i = 0; i < r.size(); i ++) { if (r[i]) { cur.clear(); for (int j = 0; j < r.size(); j ++) f[j] = 0,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:47:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < u.size(); i ++) {
                  ~~^~~~~~~~~~
train.cpp:52:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < a.size(); i ++)
                       ~~^~~~~~~~~~
train.cpp:55:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < r.size(); i ++) {
                       ~~^~~~~~~~~~
train.cpp:58:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   for (int j = 0; j < r.size(); j ++)
                                   ~~^~~~~~~~~~
train.cpp:62: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...