제출 #1247221

#제출 시각아이디문제언어결과실행 시간메모리
1247221SpyrosAliv말 (IOI15_horses)C++20
17 / 100
1594 ms8392 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; #define ll long long const ll MOD = 1e9+7; const ll MAXV = 1e9; const int MN = 5e5+5; int n; vector<int> x, y; int get_ans() { ll dp = y[n-1]; int idx = n-1; for (int i = n-2; i >= max(0, n - 32); i--) { ll dp2 = max((ll)y[i], (ll)x[i + 1] * dp); if (dp2 > MAXV) break; dp = dp2; idx = i; } ll b4 = 1; for (int i = 0; i <= idx; i++) { b4 *= x[i]; b4 %= MOD; } dp %= MOD; return b4 * dp % MOD; } int init(int N, int X[], int Y[]) { n = N; for (int i = 0; i < n; i++) { x.push_back(X[i]); y.push_back(Y[i]); } return get_ans(); } int updateX(int pos, int val) { x[pos] = val; return get_ans(); } int updateY(int pos, int val) { y[pos] = val; return get_ans(); }
#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...