Submission #1189033

#TimeUsernameProblemLanguageResultExecution timeMemory
1189033pensiveHorses (IOI15_horses)C++20
17 / 100
1595 ms12168 KiB
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;
#define REP(a,i,n) for (ll i=a;i<n;i++)
#define ll long long
#define ssize 500'005

const ll MOD = 1e9+7;
int N;
ll X[ssize], Y[ssize];

ll solve() {
    ll mx=1, runX=1, lastY=Y[N-1];
    for (int i=N-1;i>=0;i--) {
        if (runX*lastY < Y[i]) {
            runX=1;
            lastY = Y[i]; 
        }
        runX = (runX * X[i])%MOD;
    }
    return (runX*lastY)%MOD;
}

ll init(int n, int x[], int y[]) {
    N = n;
    REP(0,i,n) {
        X[i] = x[i];
        Y[i] = y[i];
    }
    return solve();
}

ll updateX(int pos, int val) {
    X[pos] = val;
    return solve();
}

ll 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...