Submission #428278

#TimeUsernameProblemLanguageResultExecution timeMemory
428278haxormanHorses (IOI15_horses)C++14
17 / 100
1580 ms12036 KiB
#include "horses.h" #include "bits/stdc++.h" using namespace std; const int mxN = 5e5 + 7; const int MOD = 1e9 + 7; int n; long long x[mxN], y[mxN]; 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]; } long long horses = 1, ans = 0; for (int i = 0; i < n; ++i) { horses *= x[i]; ans = max(ans, y[i] * horses); ans %= MOD; } return ans; } int updateX(int pos, int val) { x[pos] = val; long long horses = 1, ans = 0; for (int i = 0; i < n; ++i) { horses *= x[i]; ans = max(ans, y[i] * horses); ans %= MOD; } return ans; } int updateY(int pos, int val) { y[pos] = val; long long horses = 1, ans = 0; for (int i = 0; i < n; ++i) { horses *= x[i]; ans = max(ans, y[i] * horses); ans %= MOD; } return ans; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:24:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   24 |  return ans;
      |         ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:35:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   35 |  return ans;
      |         ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:46:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   46 |  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...