Submission #783448

# Submission time Handle Problem Language Result Execution time Memory
783448 2023-07-15T00:08:08 Z vjudge1 Toy Train (IOI17_train) C++17
5 / 100
4 ms 724 KB
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
	std::vector<int> res(a.size(),0);
    res.back() = r.back();
    int x[r.size()];
    memset(x, 0, sizeof x);
    for(int i = 0; i < u.size(); i++) {
        x[u[i]]+=1<<v[i]-u[i];
    }
    for(int i = a.size()-1; i--;) {
        if(a[i]) {
            if(x[i]%2&&r[i]) res[i] = 1;
            else if(x[i]>1&&res[i+1]) res[i] = 1;
        } else {
            if(x[i]%2&&!r[i]) res[i] = 0;
            else if(x[i]>1&&!res[i+1])res[i] = 0;
            else res[i] = 1;
        }
    }
	return res;
}

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:9:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i = 0; i < u.size(); i++) {
      |                    ~~^~~~~~~~~~
train.cpp:10:25: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   10 |         x[u[i]]+=1<<v[i]-u[i];
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 2 ms 520 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 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 4 ms 624 KB 3rd lines differ - on the 1226th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 596 KB 3rd lines differ - on the 151st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 724 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 Correct 2 ms 468 KB Output is correct
2 Correct 2 ms 520 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
13 Halted 0 ms 0 KB -