| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 553631 | InternetPerson10 | Comparing Plants (IOI20_plants) | C++17 | 81 ms | 13368 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "plants.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll BIG = 1e7;
vector<ll> ans;
int k, n;
void init(int g, std::vector<int> r) {
    k = g;
    k--;
    n = r.size();
    ans.resize(n);
    if(k == 1) {
        ans.resize(3*n+1);
        ans[0] = 0;
        for(int i = 0; i < 3*n+1; i++) {
            if(r[i%n]) ans[i] = ans[i-1] - 1;
            else ans[i] = ans[i-1] + 1;
        }
    }
	return;
}
int compare_plants(int x, int y) {
    if(k == 1) {
        for(int i = x + n - 1; i <= 3*n; i += n) {
            for(int j = y + n - 1; j <= 3*n; j += n) {
                int a = min(i, j);
                int b = max(i, j);
                if(ans[b] - ans[a] == b - a) {
                    if(a == i) return 1;
                    return -1;
                }
                if(ans[a] - ans[b] == b - a) {
                    if(a == i) return -1;
                    return 1;
                }
            }
        }
        return 0;
    }
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
