Submission #425853

# Submission time Handle Problem Language Result Execution time Memory
425853 2021-06-13T11:59:43 Z tc_abd Toy Train (IOI17_train) C++14
0 / 100
1573 ms 1356 KB
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define It it=se.begin();it!=se.end();it++
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(x) begin(x),end(x)
#define unmap unordered_map
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vi vector<int>
#define ld long double
#define ll long long
#define pb push_back
#define sh short int
#define mid (l+r)/2
#define S second
#define F first
#define sqr 708
using namespace std;
const ll inf = 1e9+1;
const ll mod = 1e9+7;
const int shift = 1e4;
const ld pai=acos(-1);

#include "train.h"
int n,m;
bool dp[5009];
bool done[50009];
vi A,R,v[5009];
bool dfs(int node,bool t){
    t = max(t,(bool)R[node]);
    if(done[node] == 1){
        dp[node] = max(dp[node],t);
        return dp[node];
    }
    done[node] = 1;
    bool ret = 1-A[node];
    for(auto u:v[node]){
        if(A[node]){
            ret = max(ret,dfs(u,t));
        }
        else{
            ret = min(ret,dfs(u,t));
        }
    }
    return ret;
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> vv) {
    n = a.size(),m = u.size();
    for(int i=0;i<n;i++){
        A.pb(a[i]);
        R.pb(r[i]);
    }
    for(int i=0;i<m;i++){
        v[u[i]].pb(vv[i]);
    }
	vector<int> ret(n);
	for(int i=0;i<n;i++){
        mem(dp,0);
        mem(done,0);
        ret[i] = dfs(i,0);
	}
	return ret;
}
# Verdict Execution time Memory Grader output
1 Incorrect 356 ms 1220 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 460 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 215 ms 1356 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 1131 ms 1108 KB 3rd lines differ - on the 75th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1573 ms 1228 KB 3rd lines differ - on the 8th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 356 ms 1220 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -