답안 #982710

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
982710 2024-05-14T16:27:51 Z vjudge1 게임 (APIO22_game) C++17
12 / 100
4000 ms 752 KB
#include "game.h"
#include <algorithm>
#include <fstream>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#include <cmath>
#include <queue>
#include <set>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <unordered_set>
#define F first
#define S second
#define PB push_back
using namespace std;
const long long MOD=1e9+7, INF=1e18;
const int INFI=1e9;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<pair<int, ii>> viii;
typedef vector<vii> vvii;
typedef vector<ll> vll;
typedef vector<vll> vvll;

int n, k;
vvi al;
bool vis[300005];
void init(int N, int K){
    n=N;    k=K;
    al.resize(n+1, vi());
    for(int i=0;i<k-1;i++)
        al[i].PB(i+1);
}
bool dfs(int node, int start){
    bool ans=false;
    if(vis[node] && node==start)   return 1;
    else if(vis[node])  return 0;
    vis[node]=true;
    for(auto ch:al[node]){
        if(dfs(ch, start)) ans=true;
    }
    return ans;
}
int add_teleporter(int u, int v){
    al[u].PB(v);
    for(int i=0;i<k;i++){
        memset(vis, false, n+1);
        if(dfs(i, i))  return 1;
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 14 ms 596 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 13 ms 344 KB Output is correct
6 Correct 13 ms 596 KB Output is correct
7 Correct 14 ms 448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 14 ms 596 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 13 ms 344 KB Output is correct
6 Correct 13 ms 596 KB Output is correct
7 Correct 14 ms 448 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 500 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 2 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 5 ms 344 KB Output is correct
18 Correct 2 ms 344 KB Output is correct
19 Correct 2 ms 440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 14 ms 596 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 13 ms 344 KB Output is correct
6 Correct 13 ms 596 KB Output is correct
7 Correct 14 ms 448 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 500 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 2 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 5 ms 344 KB Output is correct
18 Correct 2 ms 344 KB Output is correct
19 Correct 2 ms 440 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 5 ms 464 KB Output is correct
22 Correct 34 ms 620 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1104 ms 504 KB Output is correct
25 Correct 3369 ms 752 KB Output is correct
26 Correct 2672 ms 496 KB Output is correct
27 Execution timed out 4026 ms 496 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 14 ms 596 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 13 ms 344 KB Output is correct
6 Correct 13 ms 596 KB Output is correct
7 Correct 14 ms 448 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 500 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 2 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 5 ms 344 KB Output is correct
18 Correct 2 ms 344 KB Output is correct
19 Correct 2 ms 440 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 5 ms 464 KB Output is correct
22 Correct 34 ms 620 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1104 ms 504 KB Output is correct
25 Correct 3369 ms 752 KB Output is correct
26 Correct 2672 ms 496 KB Output is correct
27 Execution timed out 4026 ms 496 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 14 ms 596 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 13 ms 344 KB Output is correct
6 Correct 13 ms 596 KB Output is correct
7 Correct 14 ms 448 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 500 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 2 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 5 ms 344 KB Output is correct
18 Correct 2 ms 344 KB Output is correct
19 Correct 2 ms 440 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 5 ms 464 KB Output is correct
22 Correct 34 ms 620 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1104 ms 504 KB Output is correct
25 Correct 3369 ms 752 KB Output is correct
26 Correct 2672 ms 496 KB Output is correct
27 Execution timed out 4026 ms 496 KB Time limit exceeded
28 Halted 0 ms 0 KB -