제출 #966052

#제출 시각아이디문제언어결과실행 시간메모리
966052blackslex거래 (IZhO13_trading)C++17
100 / 100
184 ms24880 KiB
#include<bits/stdc++.h> using namespace std; using pii = pair<int, int>; int n, m, x, y, z; int main() { scanf("%d %d", &n, &m); vector<vector<pii>> oper(n + 5, vector<pii>()); for (int i = 1; i <= m; i++) scanf("%d %d %d", &x, &y, &z), oper[x].emplace_back(z - x, i), oper[y + 1].emplace_back(0, i); priority_queue<pii> pq; vector<bool> cadd(m + 5); for (int i = 1; i <= n; i++) { for (auto &[x, y]: oper[i]) { if (!cadd[y]) pq.emplace(x, y); cadd[y] = !cadd[y]; } while (!pq.empty() && !cadd[pq.top().second]) pq.pop(); printf("%d ", pq.empty() ? 0 : pq.top().first + i); } }

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

trading.cpp: In function 'int main()':
trading.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
trading.cpp:11:39: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     for (int i = 1; i <= m; i++) scanf("%d %d %d", &x, &y, &z), oper[x].emplace_back(z - x, i), oper[y + 1].emplace_back(0, i);
      |                                  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...