Submission #1021426

# Submission time Handle Problem Language Result Execution time Memory
1021426 2024-07-12T17:52:58 Z MarwenElarbi Toy Train (IOI17_train) C++17
5 / 100
5 ms 860 KB
#include <bits/stdc++.h>
#include "train.h"
 
#include <cstdio>
#include <vector>
#include <cassert>
 
using namespace std;
 
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v){
    int n=a.size();
    int m=u.size();
    bool win[n];
    bool to[n];
    memset(to,0,sizeof to);
    memset(win,0,sizeof win);
    for (int i = 0; i < m; ++i)
    {
        if(u[i]==v[i]){
            win[u[i]]=true;
        }else to[u[i]]=true;
    }
    vector<int> ans(n,0);
    for (int i = n-1; i >=0; --i)
    {
        //cout <<win[i]<<" "<<a[i]<<endl;
        if(r[i]&&a[i]&&win[i]) ans[i]=1;
        else if(!r[i]&&!a[i]&&win[i]) ans[i]=0;
        else if(!r[i]&&!to[i]) ans[i]=0;
        else if(r[i]&&!to[i]) ans[i]=1;
        else ans[i]=ans[i+1];
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 536 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 2 ms 860 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 2 ms 564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 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 5 ms 860 KB Output is correct
2 Correct 3 ms 860 KB Output is correct
3 Correct 3 ms 860 KB Output is correct
4 Incorrect 4 ms 860 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 704 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 860 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 2 ms 600 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 536 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 2 ms 860 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 2 ms 564 KB Output is correct
12 Incorrect 1 ms 344 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -