Submission #669548

# Submission time Handle Problem Language Result Execution time Memory
669548 2022-12-06T17:29:44 Z someone Toy Train (IOI17_train) C++14
Compilation error
0 ms 0 KB
//#include "train.h"
#include <bits/stdc++.h>
using namespace std;
 
const int N = 10 + 42, INF = 1e9;
 
int n, m, dp[N*N][N];
vector<int> adj[N], ans;
 
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	n = a.size();
	m = u.size();
	for(int i = 0; i < m; i++)
        adj[u[i]].push_back(v[i]);
    
    for(int i = 0; i < n*n+42; i++) {
        for(int j = 0; j < n; j++) {
            if(a[j]) {
                for(int k : adj[j])
                    dp[i+1][j] = max(dp[i+1][j], dp[i][k]);
                if(r[j])
                    dp[i+1][j]++;
            } else {
                int mini = INF;
                for(int k : adj[j])
                    mini = min(mini, dp[i][k]);
                if(r[j])
                    mini++;
                if(mini >= INF) {
                    dp[i+1][j] = 0;
                } else {
                    dp[i+1][j] = mini;
                }
            }
	    }
	}
	
	for(int j = 0; j < n; j++)
	    ans.push_back((dp[n*n+42][j] > n));
	
	return ans;
}

signed main() {
    cin >> n >> m;
    vector<int> a(n), r(n), u(m), v(m);
    for(int i = 0; i < n; i++)
        cin >> a[i];
    for(int i = 0; i < n; i++)
        cin >> r[i];
    for(int i = 0; i < m; i++)
        cin >> u[i];
    for(int i = 0; i < m; i++)
        cin >> v[i];
    who_wins(a, r, u, v);
    for(int i : ans)
        cout << i << ' ';
}

Compilation message

/usr/bin/ld: /tmp/cc4ednfE.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccAqdr7D.o:train.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status