제출 #122553

#제출 시각아이디문제언어결과실행 시간메모리
122553SirCeness장난감 기차 (IOI17_train)C++14
0 / 100
11 ms2816 KiB
#include <bits/stdc++.h> #define pb push_back #define mp make_pair using namespace std; typedef long long ll; list<int> adj[50004]; vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { for (int i = 0; i < u.size(); i++){ adj[u[i]].pb(v[i]); } vector<int> ans(a.size()); for (int i = a.size()-1; i >= 0; i--){ int kendine = 0; int ileri = 0; for (list<int>::iterator it = adj[i].begin(); it != adj[i].end(); ++it){ if (*it == i) kendine = 1; if (*it == i+1) ileri = 1; } if (kendine){ if (a[i] == 1 && r[i] == 1){ ans[i] = 1; continue; } else if (a[i] == 0 && r[i] == 0){ ans[i] = 0; continue; } } if (!ileri){ if (r[i] == 0) ans[i] = 0; else if (r[i] == 1) ans[i] = 1; break; } else { assert(i+1 != ans.size()); ans[i] = 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:11:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < u.size(); i++){
                  ~~^~~~~~~~~~
In file included from /usr/include/c++/7/cassert:44:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from train.cpp:1:
train.cpp:36:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    assert(i+1 != ans.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...