Submission #300477

# Submission time Handle Problem Language Result Execution time Memory
300477 2020-09-17T07:54:16 Z Muhammetali Comparing Plants (IOI20_plants) C++11
0 / 100
66 ms 5532 KB
#include "plants.h"
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
using namespace std;
int res[10001];
int n;
void init(int k, std::vector<int> r) {
	n=sz(r);
	for (int i=0;i<sz(r);i++)res[i]=r[i];
	return;
}

int compare_plants(int x, int y) {
	bool b=0;
	int k=res[x];
	for (int i=x+1;i<y;i++)
	{
		if (res[i]!=k)
		{
			b=1;
			break;
		}
	}
	if (b==0)
	{
		if (k==0)return 1;
		else return -1;
	}
	b=0;
	k=res[y];
	while(y!=x)
	{
		if (res[y]!=k)
		{
			b=1;
			break;
		}
		y++;
		if (y==n)y=0;
	}
	if (!b)
	{
		if (k==1)return 1;
		else return -1;
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 66 ms 3192 KB Output is correct
7 Runtime error 65 ms 5532 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Incorrect 1 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Incorrect 1 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 66 ms 3192 KB Output is correct
7 Runtime error 65 ms 5532 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -