Submission #1068255

# Submission time Handle Problem Language Result Execution time Memory
1068255 2024-08-21T08:52:09 Z edogawa_something Toy Train (IOI17_train) C++17
5 / 100
16 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 Correct 3 ms 1112 KB Output is correct
2 Correct 3 ms 1116 KB Output is correct
3 Correct 3 ms 1116 KB Output is correct
4 Correct 2 ms 1116 KB Output is correct
5 Correct 2 ms 1104 KB Output is correct
6 Correct 4 ms 1112 KB Output is correct
7 Correct 2 ms 1116 KB Output is correct
8 Correct 3 ms 1112 KB Output is correct
9 Correct 2 ms 1116 KB Output is correct
10 Correct 4 ms 1116 KB Output is correct
11 Correct 3 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 604 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 Correct 16 ms 1452 KB Output is correct
2 Correct 12 ms 1628 KB Output is correct
3 Correct 12 ms 1628 KB Output is correct
4 Incorrect 5 ms 1628 KB 3rd lines differ - on the 877th token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1116 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 4 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 Correct 3 ms 1112 KB Output is correct
2 Correct 3 ms 1116 KB Output is correct
3 Correct 3 ms 1116 KB Output is correct
4 Correct 2 ms 1116 KB Output is correct
5 Correct 2 ms 1104 KB Output is correct
6 Correct 4 ms 1112 KB Output is correct
7 Correct 2 ms 1116 KB Output is correct
8 Correct 3 ms 1112 KB Output is correct
9 Correct 2 ms 1116 KB Output is correct
10 Correct 4 ms 1116 KB Output is correct
11 Correct 3 ms 1116 KB Output is correct
12 Incorrect 0 ms 604 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -