結果
問題 |
No.2154 あさかつの参加人数
|
ユーザー |
|
提出日時 | 2024-11-21 19:54:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 170 ms / 2,000 ms |
コード長 | 355 bytes |
コンパイル時間 | 2,029 ms |
コンパイル使用メモリ | 194,824 KB |
最終ジャッジ日時 | 2025-02-25 05:48:01 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d%d", &N, &M); | ~~~~~^~~~~~~~~~~~~~~~ main.cpp:9:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d%d", &L, &R); | ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int N, M; scanf("%d%d", &N, &M); vector<int> A(N + 1); for (int i = 0; i < M; i++){ int L, R; scanf("%d%d", &L, &R); R--; A[R]++; A[L]--; } for (int i = 0; i < N; i++){ A[i + 1] += A[i]; } reverse(A.begin(), A.end()); for (int i = 1; i <= N; i++){ printf("%d\n", A[i]); } }