Submission #109095

#TimeUsernameProblemLanguageResultExecution timeMemory
109095GaruHorses (IOI15_horses)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int MAXN = 1e5 + 5; typedef long long ll; int x[MAXN] , y[MAXN]; int n; int updateX(int pos,int val) { x[pos] = val; ll ans = x[0] * y[0]; ans%=MOD; ll profit = 0; ll horses = 1; for(int i = 1 ; i < n ; i++) { horses = (horses % MOD * x[i] % MOD) % MOD; horses%=MOD; profit = (horses % MOD * y[i] % MOD) % MOD; ans = max(ans , profit); } return (int)ans; } int updateY(int pos,int val) { y[pos] = val; ll ans = (y[0] * x[0]); ans%=MOD; ll profit = 0; ll horses = x[0] for(int i = 1 ; i < n ; i++) { horses = (horses % MOD * x[i] % MOD) % MOD; horses%=MOD; profit = (horses % MOD * y[i] % MOD) % MOD; ans = max(ans , profit); } return (int)ans; } int init(int N , int X[] , int Y[]) { n = N; ll ans = x[0] * y[0]; ans%=MOD; ll profit = 0; ll horses = 1; for(int i = 0 ; i < n ; i++) { x[i] = X[i]; y[i] = Y[i]; } for(int i = 1 ; i < n ; i++) { horses = (horses % MOD * x[i] % MOD) % MOD; horses%=MOD; profit = (horses % MOD * y[i] % MOD) % MOD; ans = max(ans , profit); } return (int)ans; }

Compilation message (stderr)

horses.cpp: In function 'int updateY(int, int)':
horses.cpp:40:1: error: expected ',' or ';' before 'for'
 for(int i = 1 ; i < n ; i++)
 ^~~
horses.cpp:40:17: error: 'i' was not declared in this scope
 for(int i = 1 ; i < n ; i++)
                 ^
horses.cpp:37:4: warning: unused variable 'profit' [-Wunused-variable]
 ll profit = 0;
    ^~~~~~
horses.cpp:38:4: warning: unused variable 'horses' [-Wunused-variable]
 ll horses = x[0]
    ^~~~~~