제출 #823221

#제출 시각아이디문제언어결과실행 시간메모리
823221mindiyak장난감 기차 (IOI17_train)C++14
0 / 100
15 ms724 KiB
#include "train.h" #include <queue> #include <iostream> using namespace std; vector<int> chargers; vector<int> looped(1e4,0); vector<int> can_move(1e4,0); int N; std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { N=a.size(); for (int i = 0; i < u.size(); i++){ if(u[i] == v[i])looped[u[i]]=1; if(u[i]+1 == v[i])can_move[u[i]]=1; } vector<int> ans(N,0); ans[N-1] = r[N-1] && looped[N-1]; for(int i=N-2;i>=0;i--){ if(r[i] && looped[i]){ if(a[i])ans[i]=1; else{if(!can_move[i])ans[i]=1;} } if(can_move[i] and ans[i] == 0){ int pos = i+1; int can = 0; while(pos < N){ if(can == 1)break; if(r[pos] && looped[pos]){ if(a[i])can = 1; else{if(!can_move[i])can=1;} } pos++; } if(can)ans[i] = 1; } } 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:13:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |  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...