Submission #592964

#TimeUsernameProblemLanguageResultExecution timeMemory
592964jeremiasHorses (IOI15_horses)C++14
34 / 100
1573 ms12052 KiB
#include <bits/stdc++.h> #define forn(i, n) for (int i = 0; i < n; i++) #define forsn(i, s, n) for (int i = s; i < n; i++) #define sz(x) (int)x.size() using namespace std; const long long MOD = 1e9 + 7; vector<int> globalX, globalY; int calcmax() { long long best = 0, ret = (globalX[0] * globalY[0]) % MOD, cax = 1, cx = globalX[0]; forsn(i, 1, sz(globalX)) { cx = (cx * globalX[i]) % MOD; cax *= globalX[i]; if (globalY[best] < (cax * globalY[i])) { best = i; cax = 1; ret = (cx * globalY[i]) % MOD; } } return (int)(ret % MOD); } int updateX(int pos, int val) { globalX[pos] = val; return calcmax(); } int updateY(int pos, int val) { globalY[pos] = val; return calcmax(); } int init(int N, int X[], int Y[]) { globalX.resize(N), globalY.resize(N); forn(i, N) { globalX[i] = X[i]; globalY[i] = Y[i]; } return calcmax(); }
#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...