Submission #126586

#TimeUsernameProblemLanguageResultExecution timeMemory
126586ainta단층 (JOI16_ho_t5)C++17
34 / 100
2070 ms4728 KiB
#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)

2016_ho_t5.cpp: In function 'int main()':
2016_ho_t5.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &Q);
  ~~~~~^~~~~~~~~~~~~~~~
2016_ho_t5.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d", &w[i].x, &w[i].ck, &w[i].l);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...