Submission #1357125

#TimeUsernameProblemLanguageResultExecution timeMemory
1357125ezzzayHorses (IOI15_horses)C++20
Compilation error
0 ms0 KiB
#include "horses.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int>vx,vy;
int init(int N, int X[], int Y[]) {
    vx.clear();
    vy.clear();
    for(int i=0;i<N;i++)vx.pb(X[i]);
    for(int i=0;i<N;i++)vy.pb(Y[i]);
    int p=1;
    int mx=1;
    for(int i=0;i<N;i++){
        p=p*X[i];
        mx=max(mx,p*Y[i]);
    }
	return mx;
}

int updateX(int pos, int val) {	
    int N=vx.size();
    vx[pos]=val;
	 int p=1;
    int mx=1;
    for(int i=0;i<N;i++){
        p=p*X[i];
        mx=max(mx,p*Y[i]);
    }
	return mx;
}

int updateY(int pos, int val) {
    int N=vx.size();
    vy[pos]=val;
     int p=1;
    int mx=1;
    for(int i=0;i<N;i++){
        p=p*X[i];
        mx=max(mx,p*Y[i]);
    }
	return mx;
}

Compilation message (stderr)

horses.cpp: In function 'int updateX(int, int)':
horses.cpp:26:13: error: 'X' was not declared in this scope
   26 |         p=p*X[i];
      |             ^
horses.cpp:27:21: error: 'Y' was not declared in this scope
   27 |         mx=max(mx,p*Y[i]);
      |                     ^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:38:13: error: 'X' was not declared in this scope
   38 |         p=p*X[i];
      |             ^
horses.cpp:39:21: error: 'Y' was not declared in this scope
   39 |         mx=max(mx,p*Y[i]);
      |                     ^