| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1222174 | kargneq | 식물 비교 (IOI20_plants) | C++20 | 0 ms | 328 KiB |
#include <bits/stdc++.h>
using namespace std;
vector<int> r;
int n;
void init(int k, std::vector<int> rr) {
r = rr;
n = r.size();
}
int check(int from, int to) {
bool all_zero = true;
int x = from;
while (x != (to - 1 + n) % n) {
int next = (x + 1) % n;
if (r[x] != r[next]) {
return 0;
}
if (r[x] != 0) all_zero = false;
x = next;
}
if (all_zero)
return -1;
else
return 1;
}
int compare_plants(int x, int y) {
int res = check(x, y);
if (res != 0) return res;
res = check(y, x);
if (res != 0) return -res; // Reverse sign for opposite direction
return 0;
}| # | 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... | ||||
