Submission #388010

# Submission time Handle Problem Language Result Execution time Memory
388010 2021-04-09T18:02:32 Z Supersonic Comparing Plants (IOI20_plants) C++17
0 / 100
1 ms 304 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
int a[400001];int b[400001];int n;
void init(int k, std::vector<int> r) {
	if(k==1){
		n=r.size();
		for(int i=0;i<n;i++)r.push_back(r[i]);
		for(int i=0;i<2*n;i++)b[i]=r[i];
		a[0]=0;
		for(int i=1;i<2*n;i++){if(r[i]==r[i-1])a[i]=a[i-1];else a[i]=a[i-1]+1;}
	}
	return;
}

int compare_plants(int x, int y) {
	//cerr<<x<<' '<<y<<endl;
	if(x>y)y+=n;
	if(a[x]==a[y]){
		//cerr<<b.size()<<endl;
		if(b[x]==0)return 1;
		else return -1;
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -