# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
974642 | 2024-05-03T14:52:37 Z | IUA_Hasin | 게임 (APIO22_game) | C++17 | 20 ms | 10072 KB |
#include "game.h" #include <bits/stdc++.h> #define endl "\n" #define ll long long using namespace std; const ll N = 3e5+10; ll NN, K; std::vector<ll> graph[N]; ll vis[N]; ll vis2[N]; void dfs(ll vertex){ if(vis[vertex]==1){ return; } else { vis[vertex] = 1; // cout << vertex << " "; for(auto u : graph[vertex]){ dfs(u); } return; } } void init(int n, int k) { NN = n; K = k; for(int i=0; i<=k-2; i++){ graph[i].push_back(i+1); // cout << i << " " << i+1 << endl; } } int add_teleporter(int u, int v) { graph[u].push_back(v); if(u>=K && v<K){ vis2[u] = 1; // cout << u << " " << 59 << endl; } if(u>=v && u<K){ return 1; } else { for(int i=0; i<K; i++){ for(int i=0; i<=NN+5; i++){ vis[i] = 0; } dfs(i); std::vector<ll> last; for(int i=0; i<=NN+5; i++){ if(vis[i]==1){ last.push_back(i); // cout<<i<<" "; } } // cout<<endl; for(int i=0; i<last.size(); i++){ if(vis2[last[i]]==1){ return 1; } } } return 0; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 7768 KB | Output is correct |
2 | Correct | 2 ms | 9816 KB | Output is correct |
3 | Correct | 20 ms | 10072 KB | Output is correct |
4 | Correct | 4 ms | 9816 KB | Output is correct |
5 | Correct | 19 ms | 9816 KB | Output is correct |
6 | Correct | 19 ms | 9860 KB | Output is correct |
7 | Correct | 20 ms | 9816 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 7768 KB | Output is correct |
2 | Correct | 2 ms | 9816 KB | Output is correct |
3 | Correct | 20 ms | 10072 KB | Output is correct |
4 | Correct | 4 ms | 9816 KB | Output is correct |
5 | Correct | 19 ms | 9816 KB | Output is correct |
6 | Correct | 19 ms | 9860 KB | Output is correct |
7 | Correct | 20 ms | 9816 KB | Output is correct |
8 | Correct | 2 ms | 9816 KB | Output is correct |
9 | Correct | 2 ms | 7856 KB | Output is correct |
10 | Correct | 2 ms | 9816 KB | Output is correct |
11 | Incorrect | 2 ms | 9816 KB | Wrong Answer[1] |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 7768 KB | Output is correct |
2 | Correct | 2 ms | 9816 KB | Output is correct |
3 | Correct | 20 ms | 10072 KB | Output is correct |
4 | Correct | 4 ms | 9816 KB | Output is correct |
5 | Correct | 19 ms | 9816 KB | Output is correct |
6 | Correct | 19 ms | 9860 KB | Output is correct |
7 | Correct | 20 ms | 9816 KB | Output is correct |
8 | Correct | 2 ms | 9816 KB | Output is correct |
9 | Correct | 2 ms | 7856 KB | Output is correct |
10 | Correct | 2 ms | 9816 KB | Output is correct |
11 | Incorrect | 2 ms | 9816 KB | Wrong Answer[1] |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 7768 KB | Output is correct |
2 | Correct | 2 ms | 9816 KB | Output is correct |
3 | Correct | 20 ms | 10072 KB | Output is correct |
4 | Correct | 4 ms | 9816 KB | Output is correct |
5 | Correct | 19 ms | 9816 KB | Output is correct |
6 | Correct | 19 ms | 9860 KB | Output is correct |
7 | Correct | 20 ms | 9816 KB | Output is correct |
8 | Correct | 2 ms | 9816 KB | Output is correct |
9 | Correct | 2 ms | 7856 KB | Output is correct |
10 | Correct | 2 ms | 9816 KB | Output is correct |
11 | Incorrect | 2 ms | 9816 KB | Wrong Answer[1] |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 7768 KB | Output is correct |
2 | Correct | 2 ms | 9816 KB | Output is correct |
3 | Correct | 20 ms | 10072 KB | Output is correct |
4 | Correct | 4 ms | 9816 KB | Output is correct |
5 | Correct | 19 ms | 9816 KB | Output is correct |
6 | Correct | 19 ms | 9860 KB | Output is correct |
7 | Correct | 20 ms | 9816 KB | Output is correct |
8 | Correct | 2 ms | 9816 KB | Output is correct |
9 | Correct | 2 ms | 7856 KB | Output is correct |
10 | Correct | 2 ms | 9816 KB | Output is correct |
11 | Incorrect | 2 ms | 9816 KB | Wrong Answer[1] |
12 | Halted | 0 ms | 0 KB | - |