Submission #68397

#TimeUsernameProblemLanguageResultExecution timeMemory
68397TalantToy Train (IOI17_train)C++17
0 / 100
2074 ms82004 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 <pair<int,int> > g[N]; vector <int> res; deque <int> cur; void dfs (int e,int v) { cur.pb(v); for (auto to : g[v]) { if (f[to.fr] || to.fr == e) { f[e] = 1; for (int i = cur.size() - 1; i >= 0; i --) { if (f[cur[i]]) break; f[cur[i]] = 1; } } else if (!was[to.sc]) { was[to.sc] = 1; dfs(e,to.fr); } } 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(mk(v[i],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 < u.size(); j ++) was[j] = 0; for (int j = 0; j < r.size(); j ++) f[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:43:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < u.size(); i ++) {
                  ~~^~~~~~~~~~
train.cpp:48:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < a.size(); i ++)
                       ~~^~~~~~~~~~
train.cpp:51:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < r.size(); i ++) {
                       ~~^~~~~~~~~~
train.cpp:54:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   for (int j = 0; j < u.size(); j ++)
                                   ~~^~~~~~~~~~
train.cpp:56:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   for (int j = 0; j < r.size(); j ++)
                                   ~~^~~~~~~~~~
train.cpp:60: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...