Submission #605568

# Submission time Handle Problem Language Result Execution time Memory
605568 2022-07-25T18:54:41 Z AugustinasJucas Game (APIO22_game) C++17
2 / 100
27 ms 308 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
const int dydis = 1001;
bitset<dydis> can[dydis];
int n, k;
void init(int N, int K) {
    n = N; k = K;
    //for(int i = 0 ; i < n; i++) can[i][i] = 1;
    for(int i = 0; i < k-1; i++) {
        for(int j = i+1; j < k; j++) {
            can[i][j] = true;
        }
    }
}

int add_teleporter(int u, int v) {
    can[u][v] = 1;
    for(int h = 0; h < 300; h++){
        for(int i = 0; i < n; i++) {
            if(!can[i][u]) continue;
            can[i] |= can[v];
        }
        can[u] |= can[v];
    }

   /* cout << "kai pridejau " << u << " -> " << v << ":\n";
    for(int i = 0; i < n; i++) {
        cout << i << " gali i: ";
        for(int j = 0; j < n; j++) {
            if(can[i][j]) cout << j << ", ";
        }
        cout << endl;
    }*/
 /*   for(int i = 0; i < n; i++) {
        for(int j = 0; j < k; j++) {
            if(can[i][j] && can[j][i]) return 1;
        }
    }*/
    for(int i = 0; i < k; i++) {
     //   if(i == 0 || i == v) continue;
        if(can[i][u] && can[u][i]) {
            //cout << "pora "<< i << " ir " << u << endl;
            return 1;
        }

        if(can[i][v] && can[v][i]) {
            //cout << "pora "<< i << " ir " << v << endl;
            return 1;
        }
    }
    return 0;
}
/*
6 5 3
3 4
5 0
4 5
5 3
1 4
*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 27 ms 308 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 26 ms 308 KB Output is correct
6 Correct 26 ms 208 KB Output is correct
7 Correct 27 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 27 ms 308 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 26 ms 308 KB Output is correct
6 Correct 26 ms 208 KB Output is correct
7 Correct 27 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Incorrect 4 ms 208 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 27 ms 308 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 26 ms 308 KB Output is correct
6 Correct 26 ms 208 KB Output is correct
7 Correct 27 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Incorrect 4 ms 208 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 27 ms 308 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 26 ms 308 KB Output is correct
6 Correct 26 ms 208 KB Output is correct
7 Correct 27 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Incorrect 4 ms 208 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 27 ms 308 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 26 ms 308 KB Output is correct
6 Correct 26 ms 208 KB Output is correct
7 Correct 27 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Incorrect 4 ms 208 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -