# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
377580 | marat0210 | 식물 비교 (IOI20_plants) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <plants.h>
#include <bits/stdc++.h>
using namespace std;
vector <int> s;
int n;
void init(int k, vector <int> r)
{
n = r.size();
s.push_back(0);
for (int i: r) {
s.push_back(s.back() + i);
}
}
int compare_plants(int x, y)
{
if (x > y) return -compare_plants(y, x);
if (s[x] == s[y]) return 1;
if (s[y] == s[n] and s[0] == s[x]) return -1;
if (s[x] - x == s[y] - y) return -1;
if (s[y] - y == s[n] - n and s[0] == s[x] - x) return 1;
return 0;
}