Submission #299030

#TimeUsernameProblemLanguageResultExecution timeMemory
299030AzimjonHorses (IOI15_horses)C++17
17 / 100
1542 ms12508 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<long double, ll> pll; typedef vector<ll> vll; const ll INF = 1e18; const ll mod = 1000000000000000007ll; const ll mm = 1000000007ll; vll x, y; int n; int init(int N, int X[], int Y[]) { n = N; for (int i = 0; i < n; i++) { x.push_back(X[i]); y.push_back(Y[i]); } pll h = {0., 1}; pll jv = {-INF * 1., -INF}; for (int i = 0; i < N; i++) { h.second *= x[i]; h.first += h.second / mod; h.second %= mod; pll t = h; t.second *= y[i]; t.first += t.second / mod; t.second %= mod; jv = max(t, jv); } return jv.second % mm; } int updateX(int pos, int val) { x[pos] = val; pll h = {0, 1}; pll jv = {-INF, -INF}; for (int i = 0; i < n; i++) { h.second *= x[i]; h.first += h.second / mod; h.second %= mod; pll t = h; t.second *= y[i]; t.first += t.second / mod; t.second %= mod; jv = max(t, jv); } return jv.second % mm; } int updateY(int pos, int val) { y[pos] = val; pll h = {0, 1}; pll jv = {-INF, -INF}; for (int i = 0; i < n; i++) { h.second *= x[i]; h.first += h.second / mod; h.second %= mod; pll t = h; t.second *= y[i]; t.first += t.second / mod; t.second %= mod; jv = max(t, jv); } return jv.second % mm; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:42:19: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   42 |  return jv.second % mm;
      |         ~~~~~~~~~~^~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:64:19: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   64 |  return jv.second % mm;
      |         ~~~~~~~~~~^~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:86:19: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   86 |  return jv.second % mm;
      |         ~~~~~~~~~~^~~~
#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...