# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
833918 | finn__ | Comparing Plants (IOI20_plants) | C++17 | 74 ms | 7920 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 <bits/stdc++.h>
#include "plants.h"
using namespace std;
constexpr size_t N = 200000;
size_t n;
int subtask, s[N];
void init(int k, std::vector<int> r)
{
n = r.size();
if (k == 2)
subtask = 1;
else
subtask = 3;
if (subtask == 1)
{
partial_sum(r.begin(), r.end(), s);
}
else
{
}
}
int compare_plants(int x, int y)
{
if (subtask == 1)
{
int z = s[y - 1] - (x ? s[x - 1] : 0);
return !z ? 1 : (z == y - x ? -1 : (!(s[n - 1] - z) ? -1 : ((s[n - 1] - z == n - (y - x) ? 1 : 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... |