Submission #00028


ソースコード

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
#include<bits/stdc++.h>
#define ll long long
#define fir first
#define sec second
#define lb(v,a) lower_bound(v.begin(),v.end(),a)
#define ub(v,a) upper_bound(v.begin(),v.end(),a)
#define bs(v,a) binary_search(v.begin(),v.end(),a)
#define bitcount(i) __builtin_popcount(i)
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin>>n;
vector<long long> a(200005,0);
while(n--){
int s,t,p;
cin>>s>>t>>p;
a[s] += p;
a[t+1] -= p;
}
long long sum = 0,ans = 0;
for(int i = 0;i < a.size();i++){
sum += a[i];
ans = max(sum,ans);
}
cout<<ans<<"\n";
return(0);
}

ステータス

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

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in-1.txt AC 89 ms 2140 KB
1
in-2.txt AC 45 ms 2192 KB
1
in-3.txt AC 48 ms 2112 KB
1
in-4.txt AC 52 ms 2168 KB
1
in-5.txt AC 24 ms 2100 KB
1
in-6.txt AC 56 ms 2032 KB
1
in-sample1.txt AC 22 ms 2088 KB
1
in-sample2.txt AC 21 ms 2140 KB
1
in-sample3.txt AC 21 ms 2196 KB
1