Submission #300828

# Submission time Handle Problem Language Result Execution time Memory
300828 2020-09-17T14:07:16 Z IgorI Comparing Plants (IOI20_plants) C++17
0 / 100
1 ms 256 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 500000;
int n, k;
vector<int> r;
int p[N];

void init(int _k, vector<int> _r)
{
    n = _r.size();
    r = _r;
    k = _k;
    for (int i = 0; i < n; i++)
    {
        p[i] = p[i - 1] + r[i];
    }
}

int compare_plants(int x, int y)
{
    if (x < y)
    {
        if (p[y - 1] - p[x - 1] == 0)
        {
            return -1;
        }
        if (p[y - 1] - p[x - 1] == y - x)
        {
            return 1;
        }
        if (p[n - 1] - p[y - 1] + p[x - 1] == 0)
        {
            return 1;
        }
        if (p[n - 1] - p[y - 1] + p[x - 1] == 0)
        {
            return -1;
        }
        return 0;
    }
    return -2;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -