제출 #440797

#제출 시각아이디문제언어결과실행 시간메모리
440797parsabahrami거래 (IZhO13_trading)C++17
100 / 100
306 ms12632 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; #define SZ(x) (int) x.size() #define F first #define S second #define lc id << 1 #define rc lc | 1 const int N = 3e5 + 10, MOD = 1e9 + 7; int seg[N << 2], n, q; void upd(int ql, int qr, int x, int id = 1, int l = 1, int r = n + 1) { if (qr <= l || r <= ql) return; if (ql <= l && r <= qr) { seg[id] = max(seg[id], l - ql + x); return; } int md = (l + r) >> 1; upd(ql, qr, x, lc, l, md), upd(ql, qr, x, rc, md, r); } int get(int p, int id = 1, int l = 1, int r = n + 1) { if (r - l < 2) return seg[id]; int md = (l + r) >> 1; return max(seg[id] + p - l, p < md ? get(p, lc, l, md) : get(p, rc, md, r)); } int main() { fill(seg, seg + N * 4, -MOD); scanf("%d%d", &n, &q); for (; q; q--) { int l, r, x; scanf("%d%d%d", &l, &r, &x); upd(l, r + 1, x); } for (int i = 1; i <= n; i++) printf("%d ", max(0, get(i))); printf("\n"); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

trading.cpp: In function 'int main()':
trading.cpp:32:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |     scanf("%d%d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~
trading.cpp:34:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |         int l, r, x; scanf("%d%d%d", &l, &r, &x);
      |                      ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...