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 <bits/stdc++.h>
#define int long long
using namespace std;
array<int, 3> A[200005];//0 is type ->, 1 is type up
signed main() {
cin.sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int N, Q;
cin >> N >> Q;
int i, j;
for(i=0;i<Q;i++) {
int a, b, c;
cin >> a >> b >> c;
if(b==1) A[i] = {0, 4*c, -2*a};
if(b==2) A[i] = {1, 2*a, 4*c};
}
for(i=0;i<Q;i++) {
//cout << A[i][0] << ' ' << A[i][1] << ' ' << A[i][2] << '\n';
}
for(i=0;i<N;i++) {
int x = 2*i+1, y = -2*i-1;
for(j=Q-1;j>=0;j--) {
if(A[j][0]==0) {
if(y >= A[j][2]) x -= A[j][1];
}
else {
if(x >= A[j][1]) y -= A[j][2];
}
}
cout << -(x+y)/4 << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |