Submission #1047661

# Submission time Handle Problem Language Result Execution time Memory
1047661 2024-08-07T14:47:03 Z idas Comparing Plants (IOI20_plants) C++11
0 / 100
1 ms 2396 KB
#include "plants.h"
#include "bits/stdc++.h"
#define FOR(i, begin, end) for(int i=(begin); i<(end); i++)
#define sz(x) ((int)((x).size()))

using namespace std;
typedef long long ll;
typedef vector<int> vi;

const int MxN=2e5+10;
int n, r[MxN], inc[MxN], dc[MxN];

void init(int k, std::vector<int> R) {
	n=sz(R);
	FOR(i, 0, n) r[i]=R[i], inc[i]=dc[i]=1;

	FOR(z, 0, 3)
	FOR(i, 0, n) {
		int j=(i-1+n)%n;
		if(r[j]==0) {
			dc[j]=max(dc[j], dc[i]+1);
			inc[j]=1;
		}
		else {
			inc[j]=max(inc[j], inc[i]+1);
			dc[j]=1;
		}
	}

	// FOR(i, 0, n) {
	// 	cerr << inc[i] << " " << dc[i] << '\n';
	// }
}

int compare_plants(int x, int y) {
	int dist=y-x;
	if(inc[x]>=dist) return -1;
	if(dc[x]>=dist) return 1;
	return 0;
}

/*
7 1 0
1 1 0 1 1 1 0
*/
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -