Submission #768978

# Submission time Handle Problem Language Result Execution time Memory
768978 2023-06-29T03:56:34 Z t6twotwo Comparing Plants (IOI20_plants) C++17
Compilation error
0 ms 0 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N, K;
vector<int> R, pfs;
void init(int k, std::vector<int> r) {
	K = k, R = r; N = H.size();
	pfs.resize(N + 1);
	for (int i = 0; i < N; i++) {
		pfs[i + 1] = pfs[i] + R[i];
	}
}

int compare_plants(int x, int y) {
	if (pfs[y] - pfs[x] == 0) {
		return 1;
	}
	if (pfs[y] - pfs[x] == y - x) {
		return -1;
	}
	if (pfs[N] - pfs[y] + pfs[x] == 0) {
		return -1;
	}
	if (pfs[N] - pfs[y] + pfs[x] == N - y + x) {
		return 1;
	}
	return 0;
}

Compilation message

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:8:20: error: 'H' was not declared in this scope
    8 |  K = k, R = r; N = H.size();
      |                    ^