Submission #1117068

#TimeUsernameProblemLanguageResultExecution timeMemory
1117068ZflopHorses (IOI15_horses)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; #define ll long long const int NMAX = (int)1e5 * 6; const ll MOD = (int)1e9 + 7; ll A[NMAX],B[NMAX],n; ll POW(ll x,int p) { ll res = 1; while (p) { if (p % 2) res = res * x % MOD; p /= 2; x = x * x % MOD; } return res; } int init(int N, int X[], int Y[]) { for (int i = 0; i < N;++i) { A[i] = X[i]; B[i] = Y[i]; } n = N; ll ans = X[0] * Y[0] % MOD; ll y_ans = Y[0]; int i_ans = 0; ll x = X[0]; for (int i = 1; i < N;++i) { x = x * X[i] % MOD; int x_cur = 1; bool ok = false; for (int j = i_ans + 1; j <= i;++j) { x_cur = x_cur * X[i]; if (x_cur > MOD) { ok = true; } x_cur %= MOD; } if (x_cur * Y[i] > y_ans) ok = true; if (ok) { y_ans = Y[i]; i_ans = i; ans = x * Y[i] % MOD; } } return ans; } int updateX(int pos, int val) { A[pos] = val; return init(n,A,B); } int updateY(int pos, int val) { B[pos] = val; return init(n,A,B); }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:50:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   50 |  return ans;
      |         ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:55:14: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   55 |  return init(n,A,B);
      |              ^
horses.cpp:55:16: error: cannot convert 'long long int*' to 'int*'
   55 |  return init(n,A,B);
      |                ^
      |                |
      |                long long int*
horses.cpp:21:21: note:   initializing argument 2 of 'int init(int, int*, int*)'
   21 | int init(int N, int X[], int Y[]) {
      |                 ~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:60:14: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   60 |  return init(n,A,B);
      |              ^
horses.cpp:60:16: error: cannot convert 'long long int*' to 'int*'
   60 |  return init(n,A,B);
      |                ^
      |                |
      |                long long int*
horses.cpp:21:21: note:   initializing argument 2 of 'int init(int, int*, int*)'
   21 | int init(int N, int X[], int Y[]) {
      |                 ~~~~^~~