Submission #387647

#TimeUsernameProblemLanguageResultExecution timeMemory
387647Pichon5Horses (IOI15_horses)C++17
Compilation error
0 ms0 KiB
#include "horses.h"
#define vi vector<int>
#include <bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int tam =1005;
ll x[tam];
ll y[tam];
int n;
int solve(){
    int num=1;
    int res=0;
    for(int i=0;i<n;i++){
        num*=x[i];
        num%=mod;
        res=max(res,y[i]%mod*num%mod);
    }
    return res%mod;
}
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];
    }
    return solve();
}
int updateX(int pos, int val) {
	x[pos]=val;
	return solve();
}

int updateY(int pos, int val) {
	y[pos]=val;
	return solve();
}

Compilation message (stderr)

horses.cpp:7:1: error: 'll' does not name a type
    7 | ll x[tam];
      | ^~
horses.cpp:8:1: error: 'll' does not name a type
    8 | ll y[tam];
      | ^~
horses.cpp: In function 'int solve()':
horses.cpp:14:14: error: 'x' was not declared in this scope
   14 |         num*=x[i];
      |              ^
horses.cpp:16:21: error: 'y' was not declared in this scope
   16 |         res=max(res,y[i]%mod*num%mod);
      |                     ^
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:23:9: error: 'x' was not declared in this scope
   23 |         x[i]=X[i];
      |         ^
horses.cpp:24:9: error: 'y' was not declared in this scope
   24 |         y[i]=Y[i];
      |         ^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:29:2: error: 'x' was not declared in this scope
   29 |  x[pos]=val;
      |  ^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:34:2: error: 'y' was not declared in this scope
   34 |  y[pos]=val;
      |  ^