Submission #1014699

# Submission time Handle Problem Language Result Execution time Memory
1014699 2024-07-05T09:52:31 Z Unforgettablepl Comparing Plants (IOI20_plants) C++17
5 / 100
70 ms 14928 KB
#include <bits/stdc++.h>
using namespace std;

vector<int> limit;
vector<int> p;

void init(int k, std::vector<int> r) {
	int n = r.size();
	p=r;
	limit.resize(n);
	vector<bool> visited(n);
	function<int(int,int)> dfs = [&](int x,int type){
		if(r[x]!=type)return x;
		if(visited[x])return limit[x];
		visited[x] = true;
		return limit[x] = dfs((x+1)%n,type);
	};
	for(int i=0;i<n;i++)dfs(i,r[i]);
}

int compare_plants(int x, int y) {
	if(x>y)return -compare_plants(y,x);
	if(limit[x]<x or y<=limit[x]){
		if(p[x])return -1;
		else return 1;
	}
	if(x<=limit[y] and limit[y]<y){
		if(p[y])return 1;
		else return -1;
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 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 31 ms 4184 KB Output is correct
7 Correct 36 ms 5716 KB Output is correct
8 Correct 56 ms 8784 KB Output is correct
9 Correct 50 ms 9040 KB Output is correct
10 Correct 53 ms 8788 KB Output is correct
11 Correct 52 ms 9816 KB Output is correct
12 Correct 52 ms 12084 KB Output is correct
13 Correct 70 ms 14928 KB Output is correct
14 Correct 51 ms 14928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 348 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 1 ms 436 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 1 ms 604 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 1 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 0 ms 344 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 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 31 ms 4184 KB Output is correct
7 Correct 36 ms 5716 KB Output is correct
8 Correct 56 ms 8784 KB Output is correct
9 Correct 50 ms 9040 KB Output is correct
10 Correct 53 ms 8788 KB Output is correct
11 Correct 52 ms 9816 KB Output is correct
12 Correct 52 ms 12084 KB Output is correct
13 Correct 70 ms 14928 KB Output is correct
14 Correct 51 ms 14928 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Incorrect 0 ms 348 KB Output isn't correct
18 Halted 0 ms 0 KB -