Submission #984081

# Submission time Handle Problem Language Result Execution time Memory
984081 2024-05-16T09:56:36 Z phoenix0423 Comparing Plants (IOI20_plants) C++17
0 / 100
52 ms 15964 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define pb push_back
#define eb emplace_back
const int maxn = 2e5 + 5;
const int INF = 1e9;
#include "plants.h"
int a[maxn];
int n, k;
vector<int> r;

void init(int _k, std::vector<int> _r) {
	r = _r, k = _k;
	n = r.size();
	for(auto x : _r) r.pb(x);
	for(int i = 0; i < 2 * n; i++) a[i] = 1 - r[i] * 2;
	for(int i = 1; i < 2 * n; i++) a[i] += a[i - 1];
}

int compare_plants(int x, int y) {\
	int m = a[y - 1] - (x ? a[x - 1] : 0);
	if(m == y - x) return 1;
	if(m == x - y) return -1;
	x += n;
	m = a[x - 1] - a[y - 1];
	if(m == x - y) return -1;
	if(m == y - x) return 1;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 47 ms 4192 KB Output is correct
7 Correct 43 ms 5940 KB Output is correct
8 Runtime error 52 ms 15964 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 444 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 444 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 47 ms 4192 KB Output is correct
7 Correct 43 ms 5940 KB Output is correct
8 Runtime error 52 ms 15964 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -