Submission #1357124

#TimeUsernameProblemLanguageResultExecution timeMemory
1357124ezzzayHorses (IOI15_horses)C++20
Compilation error
0 ms0 KiB
#include "horses.h"
#include<bits/stdc++.h>
using namespace std;
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 init(int, int*, int*)':
horses.cpp:8:28: error: 'class std::vector<int>' has no member named 'pb'
    8 |     for(int i=0;i<N;i++)vx.pb(X[i]);
      |                            ^~
horses.cpp:9:28: error: 'class std::vector<int>' has no member named 'pb'
    9 |     for(int i=0;i<N;i++)vy.pb(Y[i]);
      |                            ^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:25:13: error: 'X' was not declared in this scope
   25 |         p=p*X[i];
      |             ^
horses.cpp:26:21: error: 'Y' was not declared in this scope
   26 |         mx=max(mx,p*Y[i]);
      |                     ^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:37:13: error: 'X' was not declared in this scope
   37 |         p=p*X[i];
      |             ^
horses.cpp:38:21: error: 'Y' was not declared in this scope
   38 |         mx=max(mx,p*Y[i]);
      |                     ^