제출 #68290

#제출 시각아이디문제언어결과실행 시간메모리
68290aquablitz11장난감 기차 (IOI17_train)C++14
5 / 100
2071 ms245700 KiB
#include <bits/stdc++.h> #include "train.h" using namespace std; using pii = pair<int, int>; const int N = 5e3+10; int n, m; vector<int> G[N], R[N]; bool dp[N][N], vis[N][N]; vector<int> *A, *C; bool solve(int u, int p) { if ((*C)[u]) p = n; if (p == 0) return true; if (vis[u][p]) return dp[u][p]; vis[u][p] = true; int cnt = 0; for (auto v : G[u]) if (solve(v, p-1)) ++cnt; return dp[u][p] = cnt >= ((*A)[u] ? G[u].size() : 1); } vector<int> who_wins(vector<int> A, vector<int> C, vector<int> U, vector<int> V) { ::A = &A, ::C = &C; // input n = A.size(); m = U.size(); for (int i = 0; i < m; ++i) { G[U[i]].push_back(V[i]); R[V[i]].push_back(U[i]); } vector<int> ans(n, 0); for (int u = 0; u < n; ++u) ans[u] = solve(u, n) ? 0 : 1; return ans; }

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

train.cpp: In function 'bool solve(int, int)':
train.cpp:22:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     return dp[u][p] = cnt >= ((*A)[u] ? G[u].size() : 1);
                       ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...