Submission #593952

#TimeUsernameProblemLanguageResultExecution timeMemory
593952FatihSolakToy Train (IOI17_train)C++17
11 / 100
1302 ms25112 KiB
#include "train.h" #include<cstdio> #include<algorithm> using namespace std; int n, m, D[5010], TD[5010], U[5010]; bool edge[5010][5010]; vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { n = a.size(); m = u.size(); int i, j, k; for(int i = 0;i<m;i++){ edge[u[i]][v[i]] = 1; } for (i = 0; i < n; i++) { if (r[i] == 1)D[i] = 1; else D[i] = 0; if (a[i] == 1)TD[i] = 0; else TD[i] = 1e9; } for (i = 0; i < 10003; i++) { for (j = 0; j < m; j++) { if (a[u[j]] == 1 && !(a[v[j] == 0 && r[v[j]] == 0 && edge[v[j]][v[j]]])) { TD[u[j]] = max(TD[u[j]], r[u[j]] + D[v[j]]); } else { TD[u[j]] = min(TD[u[j]], r[u[j]] + D[v[j]]); } } for (j = 0; j < n; j++) { if (i == 5002)U[j] = TD[j]; D[j] = TD[j]; if (a[j] == 1)TD[j] = 0; else TD[j] = 1e9; } } vector<int>res(n); for (j = 0; j < n; j++) { if (D[j] != U[j])res[j] = 1; else res[j] = 0; } return res; }

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:12: warning: unused variable 'k' [-Wunused-variable]
   11 |  int i, j, k;
      |            ^
#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...