Submission #1186442

#TimeUsernameProblemLanguageResultExecution timeMemory
1186442harvsftwHorses (IOI15_horses)C++20
34 / 100
12 ms4496 KiB
#include <bits/stdc++.h> #include "horses.h" using namespace std; #define MOD (1'000'000'000 + 7) #define F(i, n) for(int i = 0; i < (n); i++) #define F_reverse(i, n) for(int i = (n - 1); i >= 0; i--) int N; int X[2000], Y[2000]; int solve() { __int128_t h = 1; bool compare = true; F_reverse(i, N) { if(compare) { if(Y[i] > h) { h = Y[i]; } h *= X[i]; if(h >= 1'000'000'000) { compare = false; h %= MOD; } } else { h *= X[i]; h %= MOD; } } return h; } int init(int _N, int _X[], int _Y[]) { N = _N; F(i, N) { X[i] = _X[i]; Y[i] = _Y[i]; } return solve(); } int updateX(int pos, int val) { X[pos] = val; return solve(); } int updateY(int pos, int val) { Y[pos] = val; return solve(); }
#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...