Submission #787998

#TimeUsernameProblemLanguageResultExecution timeMemory
787998GusterGoose27Horses (IOI15_horses)C++17
17 / 100
13 ms8364 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 50; const int MOD = 1e9+7; int x[MAXN]; int y[MAXN]; int n; int solve() { ll prod = 1; ll ans = 0; for (int i = 0; i < n; i++) { prod *= x[i]; ans = max(ans, prod*y[i]); } return ans%MOD; } 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%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...