Submission #1068243

# Submission time Handle Problem Language Result Execution time Memory
1068243 2024-08-21T08:48:25 Z edogawa_something Toy Train (IOI17_train) C++17
0 / 100
7 ms 1628 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
typedef vector<ll> vii;
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define pb push_back
vii adj[5001],radj[5001];
vector<int>a,r,answer;
ll dfs(ll x) {
  if(adj[x].size()==1) {
    if(adj[x][0]==x)
      return r[x];
    else
      return dfs(x+1);
  }
  if(!(a[x]^r[x]))
    return dfs(x+1);
  return a[x];
}
vector<int> who_wins(std::vector<int> A, std::vector<int> R, std::vector<int> u, std::vector<int> v) {
  a=A,r=R;
   for(int i=0;i<u.size();i++)
      adj[u[i]].pb(v[i]);
  for(int i=0;i<a.size();i++) {
    answer.pb(dfs(i));
  }
  return answer;
}

Compilation message

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:26:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |    for(int i=0;i<u.size();i++)
      |                ~^~~~~~~~~
train.cpp:28:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   for(int i=0;i<a.size();i++) {
      |               ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1104 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1628 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1372 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1624 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1104 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -