# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
311461 | IgorI | Comparing Plants (IOI20_plants) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
+ 1, i);
while (id != -1)
{
call(id, k, r, h1);
id = CGet(i - k + 1, i);
}
h1[i] = c--;
CAdd(i - k + 1, i, -1);
CAdd(i, i + 1, INF);
}
void init(int k, vector<int> r)
{
n = r.size();
vector<int> h1(n);
c = n;
Build(0, n, 0, r);
int id = CGet(0, n);
while (id != -1)
{
call(id, k, r, h1);
id = CGet(0, n);
}
for (int i = 0; i < n; i++)
{
H[i] = h1[i];
//cout << H[i] << " ";
}
//cout << endl;
}
int compare_plants(int x, int y)
{
if (H[x] > H[y]) return 1;
return -1;
}
#ifdef LOCAL
int main()
{
int n, k, q;
cin >> n >> k >> q;
vector<int> r(n);
for (int i = 0; i < n; i++) cin >> r[i];
init(k, r);
while (q--)
{
int x, y;
cin >> x >> y;
cout << compare_plants(x, y) << endl;
}
}
#endif