Submission #56349


ソースコード

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//header{{{
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int long long
using pii = pair<int,int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> field(200050);
rep(i,n){
int l,r;
char type;
cin >> l >> r >> type;
l += 100000;
r += 100000;
if(type == '-'){
field[l]--;
field[r+1]++;
}
else{
field[l]++;
field[r+1]--;
}
}
int maxv = 0;
reps(i,200049){
field[i] += field[i-1];
chmax(maxv,field[i]);
}
cout << max(maxv,field[0]) << '\n';
return 0;
}

ステータス

項目 データ
問題 0974 - 場のポテンシャル
ユーザー名 ei1903
投稿日時 2019-11-12 23:31:38
言語 C++14
状態 Accepted
得点 10
ソースコード長 1217 Byte
最大実行時間 45 ms
最大メモリ使用量 2328 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
input-sample01 AC 20 ms 2140 KB
1
input-sample02 AC 22 ms 1940 KB
1
input01 AC 27 ms 1996 KB
1
input02 AC 34 ms 2044 KB
1
input03 AC 31 ms 2224 KB
1
input04 AC 32 ms 2148 KB
1
input05 AC 25 ms 1948 KB
1
input06 AC 28 ms 1996 KB
1
input07 AC 22 ms 2048 KB
1
input08 AC 28 ms 2100 KB
1
input09 AC 33 ms 2140 KB
1
input10 AC 25 ms 2068 KB
1
input11 AC 26 ms 2116 KB
1
input12 AC 23 ms 2292 KB
1
input13 AC 22 ms 2216 KB
1
input14 AC 37 ms 2140 KB
1
input15 AC 30 ms 2188 KB
1
input16 AC 26 ms 2240 KB
1
input17 AC 45 ms 2168 KB
1
input18 AC 30 ms 2224 KB
1
input19 AC 40 ms 2272 KB
1
input20 AC 29 ms 2328 KB
1
input21 AC 33 ms 2256 KB
1
input22 AC 22 ms 2180 KB
1
input23 AC 26 ms 2232 KB
1