Submission #227687

#TimeUsernameProblemLanguageResultExecution timeMemory
227687AaronNaidu장난감 기차 (IOI17_train)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<int> a, r, f; vector<int> graph[5000]; vector<bool> visited; bool cycleTime(int node, int orig) { if (r[node]) { return true; } if (node == orig) { return false; } return cycleTime(f[node], orig); } bool doesAWin(int x) { if (visited[x]) { return cycleTime(f[x], x); } visited[x] = true; if (a[x]) { for (auto i : graph[x]) { f[x] = i; bool b = doesAWin(i); f[x] = -1; if(b) { visited[x] = false; return true; } } visited[x] = false; return false; } else { toRet = true; for (auto i : graph[x]) { f[x] = i; bool b = doesAWin(i); f[x] = -1; if (not b) { return false; } } visited[x] = false; return true; } } vector<int> who_wins(vector<int> la, vector<int> lr, vector<int> lu, vector<int> lv) { a = la; r = lr; for (int i = 0; i < lu.size(); i++) { graph[lu[i]].push_back(lv[i]); } for (int i = 0; i < a.size(); i++) { f.push_back(-1); visited.push_back(false); } vector<int> toRet; for (int i = 0; i < a.size(); i++) { toRet.push_back(doesAWin(i)); } return toRet; }

Compilation message (stderr)

train.cpp: In function 'bool doesAWin(int)':
train.cpp:43:9: error: 'toRet' was not declared in this scope
         toRet = true;
         ^~~~~
train.cpp:43:9: note: suggested alternative: 'tzset'
         toRet = true;
         ^~~~~
         tzset
train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:62:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < lu.size(); i++)
                     ~~^~~~~~~~~~~
train.cpp:66:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < a.size(); i++)
                     ~~^~~~~~~~~~
train.cpp:72:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < a.size(); i++)
                     ~~^~~~~~~~~~