Submission #672327

#TimeUsernameProblemLanguageResultExecution timeMemory
672327Trisanu_DasHorses (IOI15_horses)C++17
34 / 100
1577 ms15868 KiB
#include "horses.h" #include <bits/stdc++.h> #define mod 1000000007 using namespace std; typedef long long ll; int n; ll x[500005], y[500005]; int solve() { ll hrspr = 1, last = 0, pref = 1, ans = 0; for(int i = 0; i < n; i++) { hrspr *= x[i]; pref = pref * x[i] % mod; if((long double)y[i] * hrspr > last) { ans = pref * y[i] % mod; hrspr = 1; last = y[i]; } } return ans; } int init(int N, int X[], int Y[]) { n = N; for(int i = 0; i < N; i++) 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(); }

Compilation message (stderr)

horses.cpp: In function 'int solve()':
horses.cpp:20:12: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   20 |     return 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...