Submission #1121826

#TimeUsernameProblemLanguageResultExecution timeMemory
1121826SalihSahinHorses (IOI15_horses)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define pb push_back using namespace std; #include "horses.h" const long long mod = 1e9 + 7; vector<array<long long, 2> > arr; int init(int N, int X[], int Y[]) { arr.resize(N); for(int i = 0; i < N; i++){ arr[i] = {X[i], Y[i]}; } long long vl = 1; int ind = 0; for(int i = N-1; i >= 0; i--){ vl *= arr[i][0]; if(vl > mod){ ind = i; break; } } vl = 1; long long precarp = 1; for(int i = 0; i < ind; i++){ precarp = (precarp * arr[i][0])%mod; } long long ans = 0; for(int i = ind; i < N; i++){ vl *= arr[i][0]; ans = max(ans, vl * arr[i][1]); } ans %= mod; ans *= precarp; ans %= mod; return ans; } int updateX(int pos, int val) { int N = arr.size(); arr[pos][0] = val; long long vl = 1; int ind = 0; for(int i = N-1; i >= 0; i--){ vl *= arr[i][0]; if(vl > mod){ ind = i; break; } } vl = 1; long long precarp = 1; for(int i = 0; i < ind; i++){ precarp = (precarp * arr[i][0])%mod; } long long ans = 0; for(int i = ind; i < N; i++){ vl *= arr[i][0]; ans = max(ans, vl * arr[i][1]); }1 ans %= mod; ans *= precarp; ans %= mod; return ans; } int updateY(int pos, int val){ int N = arr.size(); arr[pos][1] = val; long long vl = 1; int ind = 0; for(int i = N-1; i >= 0; i--){ vl *= arr[i][0]; if(vl > mod){ ind = i; break; } } vl = 1; long long precarp = 1; for(int i = 0; i < ind; i++){ precarp = (precarp * arr[i][0])%mod; } long long ans = 0; for(int i = ind; i < N; i++){ vl *= arr[i][0]; ans = max(ans, vl * arr[i][1]); } ans %= mod; ans *= precarp; ans %= mod; return ans; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:39:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   39 |     return ans;
      |            ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:43:21: warning: conversion from 'std::vector<std::array<long long int, 2> >::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   43 |     int N = arr.size();
      |             ~~~~~~~~^~
horses.cpp:64:7: error: expected ';' before 'ans'
   64 |     }1
      |       ^
      |       ;
   65 |     ans %= mod;
      |     ~~~
horses.cpp:64:6: warning: statement has no effect [-Wunused-value]
   64 |     }1
      |      ^
horses.cpp:68:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   68 |     return ans;
      |            ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:72:21: warning: conversion from 'std::vector<std::array<long long int, 2> >::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   72 |     int N = arr.size();
      |             ~~~~~~~~^~
horses.cpp:97:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   97 |     return ans;
      |            ^~~