Submission #437979

#TimeUsernameProblemLanguageResultExecution timeMemory
437979illyakrHorses (IOI15_horses)C++14
17 / 100
1576 ms12040 KiB
#include <bits/stdc++.h> #include "horses.h" using namespace std; #define ll long long const ll mod = 1000000007; int n; ll x[501010], y[501010]; 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]; } ll ans = 0, cnt = 1; for (int i = 0; i < n; i++) { cnt *= X[i]; cnt %= mod; ans = max(ans, Y[i] * cnt); ans %= mod; } return ans; } int updateX(int pos, int val) { x[pos] = val; ll ans = 0, cnt = 1; for (int i = 0; i < n; i++) { cnt *= x[i]; cnt %= mod; ans = max(ans, y[i] * cnt); ans %= mod; } return ans; } int updateY(int pos, int val) { y[pos] = val; ll ans = 0, cnt = 1; for (int i = 0; i < n; i++) { cnt *= x[i]; cnt %= mod; ans = max(ans, y[i] * cnt); ans %= mod; } return ans; }

Compilation message (stderr)

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