제출 #987185

#제출 시각아이디문제언어결과실행 시간메모리
987185AdamGSToy Train (IOI17_train)C++17
0 / 100
869 ms1708 KiB
#include "train.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() const int LIM=5e3+7; vector<int>V[LIM], S[LIM]; int deg[LIM]; vector<int>who_wins(vector<int>a, vector<int>r, vector<int>u, vector<int>v) { int n=a.size(), m=u.size(); vector<int>ans(n); rep(i, m) { V[u[i]].pb(v[i]); S[v[i]].pb(u[i]); } rep(i, n) { rep(j, n) { ans[j]=1; if(r[j]) deg[j]=0; else if(a[j]) deg[j]=V[j].size(); else deg[j]=1; } queue<int>q; rep(j, n) if(deg[j]==0) q.push(j); while(!q.empty()) { int p=q.front(); q.pop(); ans[p]=0; for(auto j : S[p]) { --deg[j]; if(deg[j]==0) q.push(j); } } rep(j, n) if(r[j]) { int sum=0; for(auto l : V[j]) sum+=ans[l]; if(a[j] && sum==V[j].size() || !a[j] && sum) r[j]=0; } } return ans; }

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

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:40:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |       if(a[j] && sum==V[j].size() || !a[j] && sum) r[j]=0;
      |                  ~~~^~~~~~~~~~~~~
train.cpp:40:15: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   40 |       if(a[j] && sum==V[j].size() || !a[j] && sum) r[j]=0;
#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...