提出 #4314235
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
int main(){
int N, M;
vector<int> L2T[200000], R2T[200000];
cin >> N >> M;
for(int i=0; i<M; i++){
int t, l, r;
cin >> t >> l >> r;
L2T[l-1].push_back(t);
R2T[r-1].push_back(t);
}
int64_t ans = 0;
set<int> st;
for(int i=0; i<N; i++){
for(int t : L2T[i]) st.insert(t);
if(st.size()) ans += *prev(st.end());
for(int t : R2T[i]) st.erase(t);
}
cout << ans << endl;
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Deforestation |
| ユーザ | betrue12 |
| 言語 | C++14 (GCC 5.4.1) |
| 得点 | 500 |
| コード長 | 544 Byte |
| 結果 | AC |
| 実行時間 | 386 ms |
| メモリ | 22144 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 500 / 500 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample-01.txt, sample-02.txt, sample-03.txt |
| All | 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, sample-01.txt, sample-02.txt, sample-03.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 01-01.txt | AC | 5 ms | 9600 KiB |
| 01-02.txt | AC | 119 ms | 14336 KiB |
| 01-03.txt | AC | 229 ms | 20480 KiB |
| 01-04.txt | AC | 15 ms | 10112 KiB |
| 01-05.txt | AC | 46 ms | 11392 KiB |
| 01-06.txt | AC | 386 ms | 21504 KiB |
| 01-07.txt | AC | 284 ms | 22144 KiB |
| 01-08.txt | AC | 320 ms | 20608 KiB |
| 01-09.txt | AC | 376 ms | 19328 KiB |
| sample-01.txt | AC | 5 ms | 9600 KiB |
| sample-02.txt | AC | 6 ms | 9600 KiB |
| sample-03.txt | AC | 6 ms | 9600 KiB |