Submission #122554

#TimeUsernameProblemLanguageResultExecution timeMemory
122554SirCenessToy Train (IOI17_train)C++14
5 / 100
9 ms1536 KiB
#include <bits/stdc++.h> #define pb push_back #define mp make_pair using namespace std; typedef long long ll; list<int> adj[5003]; 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; } else { assert(i+1 != ans.size()); ans[i] = ans[i+1]; } } return ans; }

Compilation message (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:35: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...