# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1222189 | kargneq | 식물 비교 (IOI20_plants) | C++20 | 0 ms | 0 KiB |
#include <vector>
using namespace std;
vector<int> r, h;
int n, k;
void init(int kk, vector<int> rr, vector<int> hh) {
k = kk;
r = rr;
h = hh;
n = r.size();
}
// Returns 1 if h is consistent with r, 0 otherwise
int compare_plants() {
for (int i = 0; i < n; ++i) {
int cnt = 0;
for (int j = 1; j < k; ++j) {
int nxt = (i + j) % n;
if (h[nxt] > h[i]) cnt++;
}
if (cnt != r[i]) {
return 0;
}
}
return 1;
}