Submission #00131


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <bits/stdc++.h>
#define fin << "\n"
#define lol long long int
#define nintendo switch
#define usort(a) sort(a.begin() , a.end())
#define dsort(a) sort(a.rbegin() , a.rend())
#define space << " " <<
#define push_pair(a , b) push_back(make_pair(a , b))
#define check cout << 1 fin;
#define fixout(a) cout << fixed << setprecision(a)
#define bs(a , b) binary_search(a.begin() , a.end() , b)
#define ub(a , b) upper_bound(a.begin() , a.end() , b)
#define lb(a , b) lower_bound(a.begin() , a.end() , b)
#define Iter(type) type::iterator
using namespace std;
int main(void){
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int m = 0;
vector<lol> a(2 * 100000 + 2);
for(int i = 0;i < n;i ++){
int s , t , p;
cin >> s >> t >> p;
a[s] += p;
a[t + 1] -= p;
m = max(m , t);
}
lol ma = 0 , tm = 0;
for(int i = 0;i <= m;i ++){
tm += a[i];
ma = max(ma , tm);
}
cout << ma fin;
return(0);
}

ステータス

項目 データ
問題 0008 - subscription(サブスク)
ユーザー名 Koba_gochiusa
投稿日時 2023-07-18 17:56:06
言語 C++
状態 Accepted
得点 100
ソースコード長 1038 Byte
最大実行時間 51 ms
最大メモリ使用量 2184 KB

セット

セット 得点 Cases
1 ALL 100 / 100 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in-1.txt AC 51 ms 2140 KB
1
in-2.txt AC 51 ms 2184 KB
1
in-3.txt AC 50 ms 1980 KB
1
in-4.txt AC 47 ms 2032 KB
1
in-5.txt AC 21 ms 2084 KB
1
in-6.txt AC 47 ms 2140 KB
1
in-sample1.txt AC 34 ms 2060 KB
1
in-sample2.txt AC 22 ms 2120 KB
1
in-sample3.txt AC 22 ms 2176 KB
1