제출 #708944

#제출 시각아이디문제언어결과실행 시간메모리
708944600MihneaGame (APIO22_game)C++17
60 / 100
4072 ms42764 KiB
#include <cstdio> #include <cstdlib> #include <vector> #include "game.h" #include "game.h" #include <cmath> #include <functional> #include <fstream> #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <map> #include <list> #include <time.h> #include <math.h> #include <random> #include <deque> #include <queue> #include <unordered_map> #include <unordered_set> #include <iomanip> #include <bitset> #include <cassert> #include <sstream> #include <chrono> #include <cstring> #include <numeric> using namespace std; const int R = 50; bool F; int n; int k; vector<vector<int>> g; vector<vector<int>> ig; vector<int> minAjungBucket; vector<int> minAjung; int getbucket(int x) { return x / R; } void init(int nn, int kk) { F = 0; n = nn; k = kk; minAjung.clear(); g.clear(); ig.clear(); g.resize(n + 1); ig.resize(n + 1); minAjungBucket.resize(n + 1); minAjung.resize(n + 1); for (int i = 1; i <= n; i++) { minAjungBucket[i] = getbucket(k + 1); minAjung[i] = k + 1; } } void upd(int from) { if (F) { return; } if (from <= k && minAjung[from] <= from) { F = 1; } for (auto& vec : ig[from]) { if (minAjung[from] < minAjung[vec]) { minAjung[vec] = minAjung[from]; upd(vec); } } } void updBucket(int from) { if (F) { return; } if (from <= k && minAjungBucket[from] < getbucket(from)) { // F = 1; } for (auto& vec : ig[from]) { if (minAjungBucket[from] < minAjungBucket[vec]) { minAjungBucket[vec] = minAjungBucket[from]; updBucket(vec); } } } int add_teleporter(int from, int to) { from++; to++; assert(1 <= from && from <= n); assert(1 <= to && to <= n); g[from].push_back(to); ig[to].push_back(from); { int val = ((to <= k) ? (to) : (minAjung[to])); if (val < minAjung[from]) { minAjung[from] = val; upd(from); } } { int val = ((to <= k) ? (getbucket(to)) : (minAjungBucket[to])); if (val < minAjungBucket[from]) { minAjungBucket[from] = val; updBucket(from); } } return F; }
#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...