# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
126586 | ainta | 단층 (JOI16_ho_t5) | C++17 | 2070 ms | 4728 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.
#include<cstdio>
#include<algorithm>
using namespace std;
int n, Q;
struct Query {
int x, ck, l;
}w[201000];
int main() {
int i, j;
scanf("%d%d", &n, &Q);
for (i = 1; i <= Q; i++) {
scanf("%d%d%d", &w[i].x, &w[i].ck, &w[i].l);
if (w[i].ck == 1) w[i].x--;
}
for (i = 0; i < n; i++) {
long long X = i, Y = i;
for (j = Q; j >= 1; j--) {
if (w[j].ck == 1) {
if (w[j].x >= X) {
Y -= 2 * w[j].l;
}
}
else {
if (w[j].x <= Y) {
X += 2 * w[j].l;
}
}
}
printf("%lld\n", (X - Y) / 2);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |