제출 #33763

#제출 시각아이디문제언어결과실행 시간메모리
33763mohammad_kilani장난감 기차 (IOI17_train)C++14
11 / 100
1513 ms6016 KiB
#include <bits/stdc++.h> #include "train.h" using namespace std; const int N = 5010; bitset < N > win[N]; vector< int > g[N]; int in[N]; std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { vector<int> ans; int n = a.size(); for(int i=0;i<n;i++) win[i][0] = r[i] ; for(int i=0;i<u.size();i++){ g[v[i]].push_back(u[i]); in[u[i]]++; } queue < int > q; for(int j=1;j<=n;j++){ for(int i=0;i<n;i++) if(r[i]) win[i][j] = 1; else win[i][j] = a[i] ^ 1; for(int i=0;i<u.size();i++){ int o = u[i]; int t = v[i]; if(r[o]) continue; if(a[o]){ if(win[t][j-1]) win[o][j] = 1; } else{ if(win[t][j-1] == 0) win[o][j] = 0; } } } for(int i=0;i<n;i++){ if(win[i][n] == 0){ in[i] = 0 ; q.push(i); } else if(a[i] == 0){ in[i] = 1; } } for(int i=0;i<n;i++) ans.push_back(1); while(!q.empty()){ int node = q.front(); q.pop(); ans[node] = 0 ; for(int j=0;j<g[node].size();j++){ int newnode = g[node][j]; if(in[newnode] == 0) continue; in[newnode]--; if(in[newnode] == 0) q.push(newnode); } } 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:14:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<u.size();i++){
               ^
train.cpp:21:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<u.size();i++){
                ^
train.cpp:47:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<g[node].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...