제출 #33692

#제출 시각아이디문제언어결과실행 시간메모리
33692mohammad_kilani장난감 기차 (IOI17_train)C++14
11 / 100
2000 ms2952 KiB
#include <bits/stdc++.h> #include "train.h" using namespace std; const int N = 5010; bool win[N]; int vis[N]; int vi = 0; vector<int> g[N]; vector<int> r; bool DFS(int node,int source){ if(vis[node] == vi) return false; if(r[node]) return false; vis[node] = vi; if(node == source) return true; for(int i=0;i<g[node].size();i++){ if(DFS(g[node][i],source)) return true; } return false; } bool DFS2(int node){ if(win[node]) return true; if(vis[node] == vi) return false; vis[node] = vi; for(int i=0;i<g[node].size();i++){ if(DFS2(g[node][i])) return true; } return false; } std::vector<int> who_wins(std::vector<int> a, std::vector<int> R, std::vector<int> u, std::vector<int> v) { vector<int> ans; r = R; int n = a.size(); for(int i=0;i<u.size();i++) g[u[i]].push_back(v[i]); for(int i=0;i<n;i++){ for(int j=0;j<g[i].size();j++){ vi++; if(DFS(g[i][j],i)) win[i] = 1; } } for(int i=0;i<n;i++){ vi++; if(DFS2(i)) win[i] = 1; ans.push_back(win[i] ^ 1); } return ans; }

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

train.cpp: In function 'bool DFS(int, int)':
train.cpp:15:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<g[node].size();i++){
               ^
train.cpp: In function 'bool DFS2(int)':
train.cpp:25:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<g[node].size();i++){
               ^
train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:35:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<u.size();i++) g[u[i]].push_back(v[i]);
               ^
train.cpp:37:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<g[i].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...