Submission #306507

#TimeUsernameProblemLanguageResultExecution timeMemory
306507giorgikobComparing Plants (IOI20_plants)C++14
0 / 100
4078 ms5116 KiB
#include "plants.h"

#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;

vector<int>v;
int n;

void init(int k, std::vector<int> r) {
    n = r.size();
    v = r;
	return;
}

bool check(int x,int y){
    for(int i = x; i != y; i = (i+1)%n){
        if(v[i] != 1){
            return false;
        }
	}
	return true;
}

bool check1(int x,int y){
    for(int i = x; i != y; i = (i+1)%n){
        if(v[i] != 0){
            return false;
        }
	}
	return true;
}

int compare_plants(int x, int y) {
    if(check(y,x) || check1(x,y)) return 1;
    if(check1(y,x) || check(x,y)) return -1;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...