Submission #1246107

#TimeUsernameProblemLanguageResultExecution timeMemory
1246107sano던전 (IOI21_dungeons)C++20
11 / 100
7092 ms19780 KiB
//#include "parks.h" #include<iostream> #include<vector> #include<queue> #include<deque> #include<string> #include<fstream> #include<algorithm> #include <iomanip> #include<map> #include <set> #include <unordered_map> #include <stack> #include <unordered_set> #include <cmath> #include <cstdint> #include <cassert> #include <bitset> #include <random> #include <chrono> #include <cstring> #include <variant> #define shit short int #define ll long long #define ld long double //#define int ll #define For(i, n) for(int i = 0; i < (int)n; i++) #define ffor(i, a, n) for(int i = (int)a; i < (int)n; i++) #define rfor(i, n) for(int i = (int)n; i >= (int)0; i--) #define rffor(i, a, n) for(int i = (int)n; i >= (int)a; i--) #define vec vector #define ff first #define ss second #define pb push_back #define pii pair<int, int> #define pld pair<ld, ld> #define NEK 2000000000 #define mod 1000000007 #define mod2 1000000009 #define rsz resize #define prv 43 #define prv2 47 #define D 8 #define trav(a,x) for (auto& a: x) #define pb push_back #define ub upper_bound #define lb lower_bound #define all(x) (x).begin(), (x).end() #define sig 0.0000001 using namespace std; class intervalac { int n; vec<int> l, r, in; void update(int s) { in[s] = in[s * 2] + in[s * 2 + 1]; return; } public: void postav(int vel) { n = 1; while (n < vel) n *= 2; l.resize(2 * n); r.resize(2 * n); in.resize(2 * n, 0); For(i, n) { l[i + n] = r[i + n] = i; } rffor(i, 1, (n - 1)) { l[i] = l[i * 2]; r[i] = r[i * 2 + 1]; } return; } void zmen(int a, int b) { a += n; in[a] += b; a /= 2; while (a) { update(a); a /= 2; } return; } int daj(int a, int b, int s = 1) { if (l[s] > b || r[s] < a) return 0; if (a <= l[s] && r[s] <= b) return in[s]; return daj(a, b, s * 2) + daj(a, b, s * 2 + 1); } }; int n; vec<int> s, p, w, l; void init(int n1, vec<int>s1, vec<int>p1, vec<int>w1, vec<int>l1) { n = n1; s = s1, p = p1, w = w1, l = l1; return; } ll simulate(int x1, int z1) { ll x = x1, z = z1; while (x != n) { if (s[x] > z) { z += p[x]; x = l[x]; } else { z += s[x]; x = w[x]; } } return z; } /* signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n1; cin >> n1; int q; cin >> q; vec<int> s1(n1), p1(n1), w1(n1), l1(n1); For(i, n1) { cin >> s1[i]; } For(i, n1) { cin >> p1[i]; } For(i, n1) { cin >> w1[i]; } For(i, n1) { cin >> l1[i]; } init(n1, s1, p1, w1, l1); For(i, q) { int a, b; cin >> a >> b; cout << simulate(a, b) << '\n'; } return 0; }*/
#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...