Submission #1081839

# Submission time Handle Problem Language Result Execution time Memory
1081839 2024-08-30T11:52:08 Z wood Comparing Plants (IOI20_plants) C++17
5 / 100
82 ms 8028 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>

vi pref;
int n;

void init(int k, std::vector<int> r) {
	n = r.size();
	pref.resize(n+1);
	for(int i = 0; i<n; i++)
		pref[i+1] = pref[i]+r[i];
}

int compare_plants(int x, int y) {
	int p = 1;
	if(x>y) {
		p = -1;
		swap(x,y);
	}
	if(pref[y]-pref[x]==0||pref[n]-pref[y]+pref[x]==n+x-y) return p;
	if(pref[y]-pref[x]==y-x||pref[n]-pref[y]+pref[x]==0) return -p;
	return 0;
}
# 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 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 56 ms 4028 KB Output is correct
7 Correct 36 ms 5416 KB Output is correct
8 Correct 48 ms 8016 KB Output is correct
9 Correct 82 ms 8016 KB Output is correct
10 Correct 62 ms 8020 KB Output is correct
11 Correct 51 ms 8016 KB Output is correct
12 Correct 51 ms 7884 KB Output is correct
13 Correct 47 ms 8028 KB Output is correct
14 Correct 53 ms 8016 KB Output is correct
# 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 Incorrect 1 ms 348 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 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 428 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 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 1 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 432 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 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 56 ms 4028 KB Output is correct
7 Correct 36 ms 5416 KB Output is correct
8 Correct 48 ms 8016 KB Output is correct
9 Correct 82 ms 8016 KB Output is correct
10 Correct 62 ms 8020 KB Output is correct
11 Correct 51 ms 8016 KB Output is correct
12 Correct 51 ms 7884 KB Output is correct
13 Correct 47 ms 8028 KB Output is correct
14 Correct 53 ms 8016 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Incorrect 1 ms 348 KB Output isn't correct
18 Halted 0 ms 0 KB -