Submission #617724

#TimeUsernameProblemLanguageResultExecution timeMemory
617724Sergio_2357Toy Train (IOI17_train)C++17
0 / 100
1758 ms1656 KiB
#include "train.h" #include <bits/stdc++.h> using namespace std; #define int long long typedef vector<int> vi; typedef vector<vi> vii; bool bk(int i, int d, int lp, bool obj, vi& set, vector<signed>& a, vector<signed>& r, vii& g) { if (set[i] != -1) { if (set[i] < lp) return !obj; else return obj; } set[i] = d; bool can = false; for (int ot : g[i]) { if (a[i] == a[ot]) { if (bk(ot, d + 1, (r[i] ? d : lp), a[i], set, a, r, g)) can = true; } else if (!bk(ot, d + 1, (r[i] ? d : lp), a[i], set, a, r, g)) can = true; } return can; } vector<signed> who_wins(vector<signed> a, vector<signed> r, vector<signed> u, vector<signed> v) { vector<signed> res(a.size(), 0); vii g(a.size()); for (int i = 0; i < u.size(); i++) g[u[i]].push_back(v[i]); for (int i = 0; i < a.size(); i++) { vi set(a.size(), -1); res[i] = bk(i, 0, -1, a[i], set, a, r, g); } 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:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for (int i = 0; i < u.size(); i++)
      |                     ~~^~~~~~~~~~
train.cpp:37:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     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...