제출 #57448

#제출 시각아이디문제언어결과실행 시간메모리
57448top34051장난감 기차 (IOI17_train)C++17
23 / 100
403 ms6748 KiB
#include "train.h" #include<bits/stdc++.h> using namespace std; const int maxn = 5e3 + 5; int n,m; int own[maxn], good[maxn]; vector<int> way[maxn], yaw[maxn]; int vis[maxn], deg[maxn]; queue<int> q; int res[maxn]; void solve(int st) { // printf("solve\n"); for(int i=0;i<n;i++) vis[i] = deg[i] = 0; q.push(st); while(!q.empty()) { int v = q.front(); q.pop(); if(v==st && vis[v]) continue; for(auto u : yaw[v]) { if(own[u]) { if(!vis[u]) { vis[u] = 1; q.push(u); } } else { deg[u]++; if(!vis[u] && deg[u]==way[u].size()) { vis[u] = 1; q.push(u); } } } } if(vis[st]) { for(int i=0;i<n;i++) res[i] |= vis[i]; } } vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { n = (int)a.size(); for(int i=0;i<n;i++) { own[i] = a[i]; good[i] = r[i]; } m = (int)u.size(); for(int i=0;i<m;i++) { way[u[i]].push_back(v[i]); yaw[v[i]].push_back(u[i]); } for(int i=0;i<n;i++) if(good[i]) solve(i); vector<int> ret; for(int i=0;i<n;i++) ret.push_back(res[i]); return ret; }

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

train.cpp: In function 'void solve(int)':
train.cpp:32:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if(!vis[u] && deg[u]==way[u].size()) {
                               ~~~~~~^~~~~~~~~~~~~~~
#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...