답안 #962859

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
962859 2024-04-14T09:05:00 Z 0npata 게임 (APIO22_game) C++17
2 / 100
1 ms 1112 KB
#include "game.h"
#include<bits/stdc++.h>
using namespace std;

const int N = 30'005;
const int K = 1'005;

#define pb push_back
#define vec vector

vec<int> nk(N, -1);
//vec<set<pair<int, int>>> g(N);
vec<vec<int>> g(N);
int k;
int n;

void init(int in, int ik) {
	n = in;
	k = ik;

	for(int i = 0; i<k; i++) {
		nk[i] = i;
	}
}

int add_teleporter(int u, int v) {

	nk[v] = max(nk[v], nk[u]);

	g[u].pb(v);;

	vec<int> stack{u};

	while(stack.size() > 0) {
		int cur = stack.back();
		stack.pop_back();

//		cerr << "CUR: " << cur << '\n';

		for(int nxt : g[cur]) {
			int l = nxt;

			//cerr << "l: " << l << ' ' << '\n';

			if(l<k) {
				//cerr << "HERE NO?" << '\n';
				// special node
				if(nk[cur] >= l) {
					return 1;
				}
			}

			if(nk[l] < nk[cur]) {
				stack.pb(l);
				nk[l] = nk[cur];
				//upd.pb(nxt);
			}
			//else if(nk[l] != nxt.first) {
				//upd.pb(nxt);
			//}

			//if(nxt.first >= nk[cur]) break;
		}

		//for(auto val : upd) {
			//g[cur].erase(val);
			//g[cur].insert({nk[val.second], val.second});
		//}
	}

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 1 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 1 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Incorrect 1 ms 1112 KB Wrong Answer[1]
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 1 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Incorrect 1 ms 1112 KB Wrong Answer[1]
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 1 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Incorrect 1 ms 1112 KB Wrong Answer[1]
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 1 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Incorrect 1 ms 1112 KB Wrong Answer[1]
9 Halted 0 ms 0 KB -