Submission #571821

# Submission time Handle Problem Language Result Execution time Memory
571821 2022-06-02T19:33:24 Z beaconmc Horses (IOI15_horses) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
typedef long long ll;
#define ll int
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
#define double long double

#include "horses.h"
using namespace std;


vector<ll> x, y;
ll n;

int init(int N, int X[], int Y[]) {
	n = N;
	x.push_back(X[0]);
	y.push_back(Y[0]);

	FOR(i,1,N){
		x.push_back(x[i-1] * X[i]);
		y.push_back(Y[i]);
	}
	ll maxi = -1;
	FOR(i,0,N){
		maxi = max(maxi, X[i] * Y[i]);
	}
	return maxi;
}

int updateX(int pos, int val) {	
	x[pos] = val;

	FOR(i,pos+1,n){
		x[i] *= x[i-1];
	}
	ll maxi = -1;
	FOR(i,0 n){
		maxi = max(maxi, X[i] * Y[i]);
	}
	return maxi;
}

int updateY(int pos, int val) {
	y[pos] = val;
	ll maxi = -1;
	FOR(i,0 n){
		maxi = max(maxi, X[i] * Y[i]);
	}
	return maxi;
}

Compilation message

horses.cpp:39:11: error: macro "FOR" requires 3 arguments, but only 2 given
   39 |  FOR(i,0 n){
      |           ^
horses.cpp:5: note: macro "FOR" defined here
    5 | #define FOR(i,x,y) for(ll i=x; i<y; i++)
      | 
horses.cpp:48:11: error: macro "FOR" requires 3 arguments, but only 2 given
   48 |  FOR(i,0 n){
      |           ^
horses.cpp:5: note: macro "FOR" defined here
    5 | #define FOR(i,x,y) for(ll i=x; i<y; i++)
      | 
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:39:2: error: 'FOR' was not declared in this scope
   39 |  FOR(i,0 n){
      |  ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:48:2: error: 'FOR' was not declared in this scope
   48 |  FOR(i,0 n){
      |  ^~~