Submission #732179

#TimeUsernameProblemLanguageResultExecution timeMemory
732179josanneo22Horses (IOI15_horses)C++17
34 / 100
25 ms13836 KiB
#include<bits/stdc++.h> #include<iostream> #include<stdlib.h> #include<cmath> #include <algorithm> #include<numeric> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pair<int, int> > vpii; typedef pair<ll, ll> pll; typedef vector<pll> vpll; typedef vector<ll> vll; #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define trav(a,x) for (auto& a: x) #define mp make_pair #define pb push_back #define sz(x) int(x.size()) #define all(x) begin(x), end(x) #include "horses.h" const int MAX=1e5,MOD=1e9+7; int n, x[MAX], y[MAX]; int solve(){ ll h = 1, l = 0, p = 1, resp = 0; for(int i = 1; i <= n; i++) { h *= x[i]; p = (p * x[i] % MOD); long double aux = y[i] * h; if(aux > (long double) l){ resp = (p * y[i]) % MOD; h = 1, l = y[i]; } } resp %= MOD; return (int) resp; } int init(int _n, int _x[], int _y[]){ n = _n; for(int i = 1; i <= n; i++) x[i] = _x[i - 1], y[i] = _y[i - 1]; return solve(); } int updateX(int pos, int val){ x[pos + 1] = val; return solve(); } int updateY(int pos, int val){ y[pos + 1] = 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...