# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1165935 | aminabouakaz | Pyramids (IOI24_pyramids) | C++20 | 0 ms | 0 KiB |
bool can_transform(int L, int R, int X, int Y) {
int sum_A = sumA[R] - (L > 0 ? sumA[L - 1] : 0);
int sum_B = sumB[Y] - (X > 0 ? sumB[X - 1] : 0);
if (sum_A != sum_B) {
return false;
}
for (int i = L, j = X; i <= R; ++i, ++j) {
int current_sum_A = sumA[i] - (L > 0 ? sumA[L - 1] : 0);
int current_sum_B = sumB[j] - (X > 0 ? sumB[X - 1] : 0);
if (current_sum_A != current_sum_B) {
return false;
}
}
return true;
}