Submission #299188

#TimeUsernameProblemLanguageResultExecution timeMemory
299188ASDF123Horses (IOI15_horses)C++17
0 / 100
1546 ms8864 KiB
#include "horses.h" //#include "grader.cpp" #include <bits/stdc++.h> #define ll long long using namespace std; const int N = (int)5e5 + 5; const int MOD = (int)1e9 + 7; int x[N], y[N]; int n; int calc() { ll ans = 0; ll mult = 1; for (int i = 0; i < n; i++) { mult *= x[i]; ans = max(ans, mult * y[i]); } return ans % MOD; } int init(int NN, int X[], int Y[]) { n = NN; for (int i = 0; i < n; i++) { x[i + 1] = X[i]; y[i + 1] = Y[i]; } return calc(); } int updateX(int pos, int val) { x[pos] = val; return calc(); } int updateY(int pos, int val) { y[pos] = val; return calc(); }

Compilation message (stderr)

horses.cpp: In function 'int calc()':
horses.cpp:20:14: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   20 |   return ans % MOD;
      |          ~~~~^~~~~
#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...