답안 #593415

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
593415 2022-07-11T06:24:12 Z SAAD 게임 (APIO22_game) C++17
60 / 100
532 ms 3500 KB
#define F first
#define S second
#define rep(i,a,b) for(int i=a;!(a==b&&i!=b)&&((i<=b&&b>=a)||(i>=b&&a>=b));i+=(a<=b?1:-1))
#define pb push_back
#define Fbitl __builtin_ffs
#define bit1 __builtin_popcount
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
map <int, bool> mp;
#include "game.h"
const int N = 1e5/2;
vi x[N];
int mx[N], mn[N]; 
int n,k;
void init(int n, int k) {
	::n = n;
	::k = k;
	memset(mx, -1, sizeof(mx));
	for (auto& i : mn) {
		i = 100000;
	}
	for (int i = 0; i < k - 1; i++) {
		x[i].push_back(i + 1);
		mx[i] = i;
	}
	mx[k - 1] = k - 1;
}
 
int add_teleporter(int u, int v) {
	if ( u >= v && u < k && v < k) return 1;
	x[u].push_back(v);
	if (mx[u] >= mx[v] && v < k) {
		return 1;
	}
	if (mx[u] > mx[v]) {
		queue < int > q;
		q.push(u);
		while (!q.empty()) {
			int a = q.front();
			q.pop();
			for (auto i : x[a]) {
              if (mx[a] >= mx[i] && i < k) {
						return 1;
					}
				if (mx[i] < mx[a]) {
					
					q.push(i);
					mx[i] = mx[a];
				}
			}
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1744 KB Output is correct
2 Correct 1 ms 1744 KB Output is correct
3 Correct 1 ms 1744 KB Output is correct
4 Correct 1 ms 1872 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1744 KB Output is correct
2 Correct 1 ms 1744 KB Output is correct
3 Correct 1 ms 1744 KB Output is correct
4 Correct 1 ms 1872 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1744 KB Output is correct
8 Correct 1 ms 1744 KB Output is correct
9 Correct 1 ms 1744 KB Output is correct
10 Correct 1 ms 1744 KB Output is correct
11 Correct 1 ms 1744 KB Output is correct
12 Correct 1 ms 1744 KB Output is correct
13 Correct 1 ms 1744 KB Output is correct
14 Correct 1 ms 1744 KB Output is correct
15 Correct 1 ms 1744 KB Output is correct
16 Correct 1 ms 1872 KB Output is correct
17 Correct 1 ms 1744 KB Output is correct
18 Correct 1 ms 1744 KB Output is correct
19 Correct 2 ms 1744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1744 KB Output is correct
2 Correct 1 ms 1744 KB Output is correct
3 Correct 1 ms 1744 KB Output is correct
4 Correct 1 ms 1872 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1744 KB Output is correct
8 Correct 1 ms 1744 KB Output is correct
9 Correct 1 ms 1744 KB Output is correct
10 Correct 1 ms 1744 KB Output is correct
11 Correct 1 ms 1744 KB Output is correct
12 Correct 1 ms 1744 KB Output is correct
13 Correct 1 ms 1744 KB Output is correct
14 Correct 1 ms 1744 KB Output is correct
15 Correct 1 ms 1744 KB Output is correct
16 Correct 1 ms 1872 KB Output is correct
17 Correct 1 ms 1744 KB Output is correct
18 Correct 1 ms 1744 KB Output is correct
19 Correct 2 ms 1744 KB Output is correct
20 Correct 2 ms 1872 KB Output is correct
21 Correct 1 ms 1744 KB Output is correct
22 Correct 2 ms 1892 KB Output is correct
23 Correct 1 ms 1872 KB Output is correct
24 Correct 3 ms 1872 KB Output is correct
25 Correct 4 ms 1872 KB Output is correct
26 Correct 4 ms 1872 KB Output is correct
27 Correct 3 ms 1872 KB Output is correct
28 Correct 2 ms 1872 KB Output is correct
29 Correct 3 ms 1872 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1744 KB Output is correct
2 Correct 1 ms 1744 KB Output is correct
3 Correct 1 ms 1744 KB Output is correct
4 Correct 1 ms 1872 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1744 KB Output is correct
8 Correct 1 ms 1744 KB Output is correct
9 Correct 1 ms 1744 KB Output is correct
10 Correct 1 ms 1744 KB Output is correct
11 Correct 1 ms 1744 KB Output is correct
12 Correct 1 ms 1744 KB Output is correct
13 Correct 1 ms 1744 KB Output is correct
14 Correct 1 ms 1744 KB Output is correct
15 Correct 1 ms 1744 KB Output is correct
16 Correct 1 ms 1872 KB Output is correct
17 Correct 1 ms 1744 KB Output is correct
18 Correct 1 ms 1744 KB Output is correct
19 Correct 2 ms 1744 KB Output is correct
20 Correct 2 ms 1872 KB Output is correct
21 Correct 1 ms 1744 KB Output is correct
22 Correct 2 ms 1892 KB Output is correct
23 Correct 1 ms 1872 KB Output is correct
24 Correct 3 ms 1872 KB Output is correct
25 Correct 4 ms 1872 KB Output is correct
26 Correct 4 ms 1872 KB Output is correct
27 Correct 3 ms 1872 KB Output is correct
28 Correct 2 ms 1872 KB Output is correct
29 Correct 3 ms 1872 KB Output is correct
30 Correct 12 ms 2384 KB Output is correct
31 Correct 4 ms 1980 KB Output is correct
32 Correct 17 ms 2748 KB Output is correct
33 Correct 17 ms 2808 KB Output is correct
34 Correct 532 ms 2820 KB Output is correct
35 Correct 193 ms 2800 KB Output is correct
36 Correct 30 ms 2740 KB Output is correct
37 Correct 21 ms 2760 KB Output is correct
38 Correct 20 ms 2536 KB Output is correct
39 Correct 21 ms 2488 KB Output is correct
40 Correct 421 ms 2860 KB Output is correct
41 Correct 89 ms 2640 KB Output is correct
42 Correct 70 ms 2616 KB Output is correct
43 Correct 31 ms 2796 KB Output is correct
44 Correct 275 ms 2812 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1744 KB Output is correct
2 Correct 1 ms 1744 KB Output is correct
3 Correct 1 ms 1744 KB Output is correct
4 Correct 1 ms 1872 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1744 KB Output is correct
8 Correct 1 ms 1744 KB Output is correct
9 Correct 1 ms 1744 KB Output is correct
10 Correct 1 ms 1744 KB Output is correct
11 Correct 1 ms 1744 KB Output is correct
12 Correct 1 ms 1744 KB Output is correct
13 Correct 1 ms 1744 KB Output is correct
14 Correct 1 ms 1744 KB Output is correct
15 Correct 1 ms 1744 KB Output is correct
16 Correct 1 ms 1872 KB Output is correct
17 Correct 1 ms 1744 KB Output is correct
18 Correct 1 ms 1744 KB Output is correct
19 Correct 2 ms 1744 KB Output is correct
20 Correct 2 ms 1872 KB Output is correct
21 Correct 1 ms 1744 KB Output is correct
22 Correct 2 ms 1892 KB Output is correct
23 Correct 1 ms 1872 KB Output is correct
24 Correct 3 ms 1872 KB Output is correct
25 Correct 4 ms 1872 KB Output is correct
26 Correct 4 ms 1872 KB Output is correct
27 Correct 3 ms 1872 KB Output is correct
28 Correct 2 ms 1872 KB Output is correct
29 Correct 3 ms 1872 KB Output is correct
30 Correct 12 ms 2384 KB Output is correct
31 Correct 4 ms 1980 KB Output is correct
32 Correct 17 ms 2748 KB Output is correct
33 Correct 17 ms 2808 KB Output is correct
34 Correct 532 ms 2820 KB Output is correct
35 Correct 193 ms 2800 KB Output is correct
36 Correct 30 ms 2740 KB Output is correct
37 Correct 21 ms 2760 KB Output is correct
38 Correct 20 ms 2536 KB Output is correct
39 Correct 21 ms 2488 KB Output is correct
40 Correct 421 ms 2860 KB Output is correct
41 Correct 89 ms 2640 KB Output is correct
42 Correct 70 ms 2616 KB Output is correct
43 Correct 31 ms 2796 KB Output is correct
44 Correct 275 ms 2812 KB Output is correct
45 Runtime error 3 ms 3500 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -