제출 #1208467

#제출 시각아이디문제언어결과실행 시간메모리
1208467fskarica게임 (APIO22_game)C++20
0 / 100
2 ms5096 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define pii pair<int, int> const int INF = 1e9; const int MAX = 1e5 + 10; int n, k; int in[MAX], out[MAX]; vector<int> veze[MAX], vezeRev[MAX]; void init(int N, int K) { n = N; k = K; for (int i = 0; i < n; i++) { if (i < k) { in[i] = i; out[i] = i; } else { in[i] = -1; out[i] = INF; } } } void rekIn(int pos, int novo) { if (in[pos] >= novo) return; in[pos] = novo; for (int e : veze[pos]) { rekIn(e, novo); } } void rekOut(int pos, int novo) { if (out[pos] <= novo) return; out[pos] = novo; for (int e : vezeRev[pos]) { rekOut(e, novo); } } int add_teleporter(int x, int y) { if (x < k && y < k) { return x >= y; } veze[x].push_back(y); vezeRev[y].push_back(x); int tempIn = in[x]; int tempOut = out[y]; rekIn(y, tempIn); rekOut(x, tempOut); return in[x] >= out[y]; } //int main() { // int n, k; // cin >> n >> k; // init(n, k); // // while (true) { // int x, y; // cin >> x >> y; // // if (add_teleporter(x, y)) break; // } //}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...