제출 #227688

#제출 시각아이디문제언어결과실행 시간메모리
227688AaronNaidu장난감 기차 (IOI17_train)C++14
0 / 100
2093 ms1152 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 { 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; }

컴파일 시 표준 에러 (stderr) 메시지

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:61:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < lu.size(); i++)
                     ~~^~~~~~~~~~~
train.cpp:65:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < a.size(); i++)
                     ~~^~~~~~~~~~
train.cpp:71:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     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...