답안 #724335

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
724335 2023-04-15T06:02:41 Z MohamedAliSaidane 게임 (APIO22_game) C++17
30 / 100
557 ms 5696 KB
#include<bits/stdc++.h>
#include "game.h"
#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpi;

#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(),(x).end()

const ll MOD = 1e9 + 7, INF = 1e18;
ll mod(ll x, ll m = MOD) {return (x + m) % m;}

const int nax = 3e4 ;
const int kax = 1000;


int n, k;
bitset<nax> g[kax];
vi rev_adj[nax];
void init(int N, int K)
{
    n = N, k = K;
    for(int i = 0; i < k; i++)
    {

         for(int j =0 ; j <= i; j++)
            g[i][j] = 1;
     }

}

int add_teleporter(int u, int v)
{
    if(u < k && v <= u)
        return 1;
    if(v == u)
        return 0;

    for(int i = 0; i < k; i++)
    {
        if(g[i][v])
        {
            queue<int> q;
            q.push(u);
            g[i][u] = 1;
            while(!q.empty())
            {
                int node = q.front();
                q.pop();
                if(node < k && node >= i)
                    return 1;
                for(auto e: rev_adj[node])
                {
                    if(g[i][e])
                        continue;
                    g[i][e] = 1;
                    q.push(e);
                }
            }
        }
    }
    rev_adj[v].pb(u);
    return 0;
}
/*
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    init(n, k);
    while(m--)
    {
        int u, v;
        cin >> u >> v;
        cout << add_teleporter(u, v) << endl;
    }
}
*/

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1008 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 2 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 2 ms 1360 KB Output is correct
7 Correct 2 ms 1360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1008 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 2 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 2 ms 1360 KB Output is correct
7 Correct 2 ms 1360 KB Output is correct
8 Correct 1 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1104 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1008 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 2 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 2 ms 1360 KB Output is correct
7 Correct 2 ms 1360 KB Output is correct
8 Correct 1 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1104 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 1048 KB Output is correct
21 Correct 1 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 7 ms 2872 KB Output is correct
25 Correct 15 ms 1904 KB Output is correct
26 Correct 6 ms 1408 KB Output is correct
27 Correct 6 ms 2768 KB Output is correct
28 Correct 18 ms 2792 KB Output is correct
29 Correct 29 ms 2784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1008 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 2 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 2 ms 1360 KB Output is correct
7 Correct 2 ms 1360 KB Output is correct
8 Correct 1 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1104 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 1048 KB Output is correct
21 Correct 1 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 7 ms 2872 KB Output is correct
25 Correct 15 ms 1904 KB Output is correct
26 Correct 6 ms 1408 KB Output is correct
27 Correct 6 ms 2768 KB Output is correct
28 Correct 18 ms 2792 KB Output is correct
29 Correct 29 ms 2784 KB Output is correct
30 Correct 17 ms 1944 KB Output is correct
31 Correct 33 ms 4808 KB Output is correct
32 Correct 20 ms 2248 KB Output is correct
33 Correct 14 ms 1936 KB Output is correct
34 Incorrect 557 ms 5696 KB Wrong Answer[1]
35 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1008 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 2 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 2 ms 1360 KB Output is correct
7 Correct 2 ms 1360 KB Output is correct
8 Correct 1 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1104 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 1048 KB Output is correct
21 Correct 1 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 7 ms 2872 KB Output is correct
25 Correct 15 ms 1904 KB Output is correct
26 Correct 6 ms 1408 KB Output is correct
27 Correct 6 ms 2768 KB Output is correct
28 Correct 18 ms 2792 KB Output is correct
29 Correct 29 ms 2784 KB Output is correct
30 Correct 17 ms 1944 KB Output is correct
31 Correct 33 ms 4808 KB Output is correct
32 Correct 20 ms 2248 KB Output is correct
33 Correct 14 ms 1936 KB Output is correct
34 Incorrect 557 ms 5696 KB Wrong Answer[1]
35 Halted 0 ms 0 KB -