제출 #69903

#제출 시각아이디문제언어결과실행 시간메모리
69903bnahmad15장난감 기차 (IOI17_train)C++17
0 / 100
1798 ms1472 KiB
#include "train.h" #include <bits/stdc++.h> using namespace std; const int N = 5001; int n,can[N],is[N],cnt = 0,low[N],tim[N],vis[N]; vector <int> g[N],S; void dfs(int u){ low[u] = tim[u] = ++cnt; vis[u] = 1; S.push_back(u); for(int i = 0;i<g[u].size();i++){ int v = g[u][i]; if(tim[v] == -1){ dfs(v); } if(vis[v] == 1){ low[u] = min(low[u],low[v]); } } if(low[u] == tim[u]){ while(1){ int v = S.back(); vis[v] = -1; S.pop_back(); if(u == v){break;} } } } std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { std::vector<int> res; n = a.size(); for(int i = 0;i<n;i++){ can[i] = 0; is[i] = 0; } for(int i = 0;i<u.size();i++){ g[u[i]].push_back(v[i]); } for(int i = 0;i<n;i++) is[i] = r[i]; for(int i = 0;i<n;i++){ if(r[i] == 1){ for(int j = 0;j<n;j++){ low[j] = tim[j] = vis[j] = -1; } cnt = 0; dfs(i); int flag = 0; for(int i = 0;i<n;i++){ if(low[i] == 1 && is[i] == 1) flag = 1; } if(flag == 1){ for(int i = 0;i<n;i++){ if(low[i] == 1) can[i] = 1; } } } } for(int i = 0;i<n;i++){ res.push_back(can[i]); } return res; }

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

train.cpp: In function 'void dfs(int)':
train.cpp:13:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0;i<g[u].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:39:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0;i<u.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...