Submission #815449

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