結果

問題 No.2154 あさかつの参加人数
ユーザー Kome_soudouKome_soudou
提出日時 2022-12-09 21:28:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 926 ms / 2,000 ms
コード長 345 bytes
コンパイル時間 1,551 ms
コンパイル使用メモリ 165,180 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-22 20:30:15
合計ジャッジ時間 20,546 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 884 ms
6,816 KB
testcase_01 AC 897 ms
6,940 KB
testcase_02 AC 867 ms
6,944 KB
testcase_03 AC 889 ms
6,940 KB
testcase_04 AC 926 ms
6,940 KB
testcase_05 AC 157 ms
6,940 KB
testcase_06 AC 497 ms
6,948 KB
testcase_07 AC 507 ms
6,940 KB
testcase_08 AC 578 ms
6,940 KB
testcase_09 AC 321 ms
6,940 KB
testcase_10 AC 480 ms
6,944 KB
testcase_11 AC 768 ms
6,940 KB
testcase_12 AC 542 ms
6,940 KB
testcase_13 AC 251 ms
6,944 KB
testcase_14 AC 542 ms
6,944 KB
testcase_15 AC 521 ms
6,940 KB
testcase_16 AC 640 ms
6,944 KB
testcase_17 AC 564 ms
6,940 KB
testcase_18 AC 709 ms
6,944 KB
testcase_19 AC 81 ms
6,940 KB
testcase_20 AC 652 ms
6,940 KB
testcase_21 AC 288 ms
6,940 KB
testcase_22 AC 570 ms
6,940 KB
testcase_23 AC 675 ms
6,940 KB
testcase_24 AC 774 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	int l, r;
	vector<int> ans(n);
	for(int i = 0; i < m; i++)
	{
		cin >> l >> r;
		l--; r--;
		ans[r]++;
		if(l + 1 < n) ans[l + 1]--;
	}
	
	for(int i = 1; i < n; i++) ans[i] += ans[i - 1];
	for(int i = n - 1; i >= 0; i--) cout << ans[i] << endl;
	return 0;
}
0