Submission #291401

#TimeUsernameProblemLanguageResultExecution timeMemory
291401abyyskitToy Train (IOI17_train)C++14
5 / 100
9 ms1280 KiB
#include "train.h" #include<bits/stdc++.h> using namespace std; #define FOR(i, x, y) for(int i = x; i < y; ++i) #define pb push_back struct node{ vector<int> e; bool charge = false; bool A = false; }; vector<node> g; vector<int> subtask1(){ vector<int> ans(g.size(), 0); for(int i = g.size() - 1; i >= 0; --i){ if (g[i].A){ ans[i] = 0; } else{ ans[i] = 1; } FOR(j, 0, g[i].e.size()){ int nex = g[i].e[j]; // cout << "nex: " << nex << "\n"; if (g[i].A){ if (g[i].charge && nex == i){ ans[i] = 1; break; } if (nex != i){ ans[i] = max(ans[i], ans[i + 1]); } } else{ if (nex == i){ if (!g[i].charge){ ans[i] = 0; break; } } else{ ans[i] = min(ans[i], ans[i + 1]); } } } } return ans; } vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v){ g.resize(a.size()); FOR(i, 0, u.size()){ g[u[i]].e.pb(v[i]); } // cout << "here\n"; FOR(i, 0, a.size()){ if (a[i] == 1){ g[i].A = true; } if (r[i] == 1){ g[i].charge = true; } } // cout << "here2" << "\n"; return subtask1(); }

Compilation message (stderr)

train.cpp: In function 'std::vector<int> subtask1()':
train.cpp:4:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    4 | #define FOR(i, x, y) for(int i = x; i < y; ++i)
......
   25 |   FOR(j, 0, g[i].e.size()){
      |       ~~~~~~~~~~~~~~~~~~~              
train.cpp:25:3: note: in expansion of macro 'FOR'
   25 |   FOR(j, 0, g[i].e.size()){
      |   ^~~
train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:4:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    4 | #define FOR(i, x, y) for(int i = x; i < y; ++i)
......
   57 |  FOR(i, 0, u.size()){
      |      ~~~~~~~~~~~~~~                    
train.cpp:57:2: note: in expansion of macro 'FOR'
   57 |  FOR(i, 0, u.size()){
      |  ^~~
train.cpp:4:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    4 | #define FOR(i, x, y) for(int i = x; i < y; ++i)
......
   61 |  FOR(i, 0, a.size()){
      |      ~~~~~~~~~~~~~~                    
train.cpp:61:2: note: in expansion of macro 'FOR'
   61 |  FOR(i, 0, a.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...