Submission #815435

# Submission time Handle Problem Language Result Execution time Memory
815435 2023-08-08T15:07:26 Z vjudge1 Comparing Plants (IOI20_plants) C++17
0 / 100
1 ms 300 KB
#include <iostream>
#include <vector>
using namespace std;
int n, h;
vector<int> v;
void init(int k, vector<int> r)
{
    v = r;
    n = r.size();
    h = k;
}
int compare_plants(int x, int y)
{
    int z = 0, i;
    if (h == 2)
    {
        for (i = x; i < y; i++)
        {
            if (v[i] == 1)
                z--;
            else
                z++;
        }
        if (z == y - x)
            return 1;
        if (z == x - y)
            return -1;
        z = 0;
        for (i = y; i < x + n; i++)
        {
            if (v[i % n] == 1)
                z--;
            else
                z++;
        }
        if (z == y - x)
            return 1;
        if (z == x - y)
            return -1;
        return 0;
    }
    return z;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 300 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 296 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 296 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 300 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 300 KB Output isn't correct
3 Halted 0 ms 0 KB -