Submission #1004537

# Submission time Handle Problem Language Result Execution time Memory
1004537 2024-06-21T09:39:49 Z ayankarimova Horses (IOI15_horses) C++14
Compilation error
0 ms 0 KB
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
const ll mod=1e9+7;
/*
{} []
*/
int init(int n, int x[], int y[]) {

    ll num=1, ans=0;
    for(int i=0; i<n; i++){
        num*=x[i];
        ans=max(ans, num*y[i]%mod);
        num%=mod;
    }
	return ans;
}

int updateX(int pos, int val) {
    
    x[pos]=val;
	ll num=1, ans=0;
    for(int i=0; i<n; i++){
        num*=x[i];
        ans=max(ans, num*y[i]%mod);
        num%=mod;
    }
	return ans;
}

int updateY(int pos, int val) {
	y[pos]=val;
	ll num=1, ans=0;
    for(int i=0; i<n; i++){
        num*=x[i];
        ans=max(ans, num*y[i]%mod);
        num%=mod;
    }
	return ans;
}

Compilation message

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:18:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   18 |  return ans;
      |         ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:23:5: error: 'x' was not declared in this scope
   23 |     x[pos]=val;
      |     ^
horses.cpp:25:20: error: 'n' was not declared in this scope
   25 |     for(int i=0; i<n; i++){
      |                    ^
horses.cpp:27:26: error: 'y' was not declared in this scope
   27 |         ans=max(ans, num*y[i]%mod);
      |                          ^
horses.cpp:30:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   30 |  return ans;
      |         ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:34:2: error: 'y' was not declared in this scope; did you mean 'yn'?
   34 |  y[pos]=val;
      |  ^
      |  yn
horses.cpp:36:20: error: 'n' was not declared in this scope
   36 |     for(int i=0; i<n; i++){
      |                    ^
horses.cpp:37:14: error: 'x' was not declared in this scope
   37 |         num*=x[i];
      |              ^
horses.cpp:41:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   41 |  return ans;
      |         ^~~