Submission #963133

# Submission time Handle Problem Language Result Execution time Memory
963133 2024-04-14T14:52:49 Z anton Star Trek (CEOI20_startrek) C++17
8 / 100
1000 ms 576 KB
#include<bits/stdc++.h>

using namespace std;
#define int long long

const int MAX_N = 1000;
const int mod = 1e9+7;


vector<int> adj[2*MAX_N];

bool can_win[2*MAX_N];

void find_win(int u,int p, int a){
    for(auto v: adj[u]){
        if( v!=a){
            find_win( v, (p+1)%2, u);
        }
    }
    
    if(p == 0){
        can_win[u] = false;
        for(auto v: adj[u]){
            if( v!=a){
                can_win[u] |= can_win[v];
            }
        }
    }
    else{
        can_win[u] = true;
        for(auto v: adj[u]){
            if(v!=a){
                can_win[u] &= can_win[v];
            }
        }
    }
}






signed main(){
    int n, d;
    cin>>n>>d;
    for(int i = 0; i<n-1;i++){
        int a, b;
        cin>>a>>b;

        adj[a-1].push_back(b-1);
        adj[b-1].push_back(a-1);
        adj[a-1+n].push_back(n+b-1);
        adj[b-1+n].push_back(n+a-1);

    }

    

    int res= 0;

    for(int a = 0; a<n; a++){
        for(int b=  n; b<2*n; b++){
            adj[a].push_back(b);
            find_win(0, 0, -1);
            if(can_win[0]){
                res++;
            }
            adj[a].pop_back();
        }
    }

    cout<<res<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Execution timed out 1091 ms 348 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 16 ms 492 KB Output is correct
3 Correct 16 ms 344 KB Output is correct
4 Correct 13 ms 344 KB Output is correct
5 Correct 15 ms 488 KB Output is correct
6 Correct 18 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 16 ms 492 KB Output is correct
3 Correct 16 ms 344 KB Output is correct
4 Correct 13 ms 344 KB Output is correct
5 Correct 15 ms 488 KB Output is correct
6 Correct 18 ms 348 KB Output is correct
7 Execution timed out 1070 ms 576 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 16 ms 492 KB Output is correct
3 Correct 16 ms 344 KB Output is correct
4 Correct 13 ms 344 KB Output is correct
5 Correct 15 ms 488 KB Output is correct
6 Correct 18 ms 348 KB Output is correct
7 Execution timed out 1070 ms 576 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 16 ms 492 KB Output is correct
3 Correct 16 ms 344 KB Output is correct
4 Correct 13 ms 344 KB Output is correct
5 Correct 15 ms 488 KB Output is correct
6 Correct 18 ms 348 KB Output is correct
7 Execution timed out 1070 ms 576 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 16 ms 492 KB Output is correct
3 Correct 16 ms 344 KB Output is correct
4 Correct 13 ms 344 KB Output is correct
5 Correct 15 ms 488 KB Output is correct
6 Correct 18 ms 348 KB Output is correct
7 Execution timed out 1070 ms 576 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Execution timed out 1091 ms 348 KB Time limit exceeded
3 Halted 0 ms 0 KB -