Submission #422905

#TimeUsernameProblemLanguageResultExecution timeMemory
422905schseToy Train (IOI17_train)C++17
0 / 100
1816 ms1332 KiB
#include "train.h" #ifndef EVAL #include "grader.cpp" #endif #define DEACTIVATED -1 #define UNKNOWN 0 #include <bits/stdc++.h> using namespace std; struct node { vector<int> edges; bool been; bool actice; int chargingsationsbefore = INT32_MAX; bool charging = false; bool owner; bool winningpos = false; }; vector<node> g; int dfs(int n, int charging) { if (g[n].actice && g[n].chargingsationsbefore < charging) return true; else if (g[n].been) return false; g[n].been = true; g[n].actice = true; g[n].chargingsationsbefore = charging; if (g[n].charging) charging++; bool b = false; for (int i : g[n].edges) { b |= dfs(i, charging); } g[n].actice = false; g[n].chargingsationsbefore = INT32_MAX; return b; } vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { g.resize(a.size()); for (int i = 0; i < a.size(); i++) { g[i].owner = a[i]; g[i].charging = r[i]; } for (int i = 0; i < u.size(); i++) { g[u[i]].edges.push_back(v[i]); } vector<int> res(a.size(), 0); for (int i = 0; i < (int)a.size(); i++) { for (int i = 0; i < a.size(); i++) g[i].been = false; res[i] = dfs(i, 0); } 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:50:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |  for (int i = 0; i < a.size(); i++)
      |                  ~~^~~~~~~~~~
train.cpp:55:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |  for (int i = 0; i < u.size(); i++)
      |                  ~~^~~~~~~~~~
train.cpp:63:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |   for (int i = 0; i < a.size(); 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...