제출 #1195787

#제출 시각아이디문제언어결과실행 시간메모리
1195787belgianbotDungeons Game (IOI21_dungeons)C++20
0 / 100
1 ms320 KiB
#include "dungeons.h" #include <bits/stdc++.h> using namespace std; const int MAX_N = 400000; bool processed[MAX_N] = {false}; long long cycle[MAX_N]; vector<int> s,p,w,l; queue<int> q; int n; void proc(int i, long long sz) { if (processed[i] || i == n) { if (i == n) sz = LLONG_MAX; while(!q.empty()) { int x = q.front(); q.pop(); cycle[i] = sz; } return; } processed[i] = true; proc(l[i], sz + p[i]); } void init(int nn, vector<int> ss, vector<int> pp, vector<int> ww, vector<int> ll) { s = ss; p = pp; w = ww; l = ll; n = nn; for (int i = 0; i < n; i++) { if (!processed[i]) proc(i, 0); } return; } long long simulate(int x, int z) { long long st = z; st += (s[x] - st) / cycle[x] * cycle[x]; int pos = x; while (st < s[x]) { st += p[pos]; pos = l[pos]; } return st; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...