Submission #41974


ソースコード

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
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
int dx[]={1,0,-1,0};
int dy[]={0,-1,0,1};
int dxx[]={1,1,0,-1,-1,-1,0,1};
int dyy[]={0,-1,-1,-1,0,1,1,1};
bool inside(int x,int y,int w,int h){
return (x>=0 && y>=0 && x<w && y<h);}
typedef long long ll;
typedef pair<int,int> pii;
#define MIDLE 100000
int main(){
cin.tie(0), ios::sync_with_stdio(false);
int n,l,r;
int lef=1<<30,ri=-1<<30;
int once[200005]={};
string type;
cin >>n;
FOR(i,n){
cin >>l>>r>>type;
lef=min(lef,l);
ri=max(ri,r);
if(type=="+"){
once[l+MIDLE]++;
once[r+1+MIDLE]--;
}else{
once[l+MIDLE]--;
once[r+1+MIDLE]++;
}
}
int ans=0;
iFOR(i,lef+MIDLE,ri+1+MIDLE){
once[i]+=once[i-1];
ans=max(ans,once[i]);
}
cout <<ans<<endl;
return 0;
}

ステータス

項目 データ
問題 0974 - 場のポテンシャル
ユーザー名 ei1821
投稿日時 2018-08-27 20:19:31
言語 C++11
状態 Accepted
得点 10
ソースコード長 963 Byte
最大実行時間 41 ms
最大メモリ使用量 1512 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
input-sample01 AC 30 ms 1248 KB
1
input-sample02 AC 22 ms 1452 KB
1
input01 AC 31 ms 1400 KB
1
input02 AC 35 ms 1476 KB
1
input03 AC 40 ms 1296 KB
1
input04 AC 33 ms 1376 KB
1
input05 AC 29 ms 1328 KB
1
input06 AC 32 ms 1404 KB
1
input07 AC 25 ms 1480 KB
1
input08 AC 37 ms 1428 KB
1
input09 AC 38 ms 1376 KB
1
input10 AC 32 ms 1448 KB
1
input11 AC 25 ms 1392 KB
1
input12 AC 21 ms 1468 KB
1
input13 AC 26 ms 1292 KB
1
input14 AC 37 ms 1240 KB
1
input15 AC 35 ms 1440 KB
1
input16 AC 28 ms 1384 KB
1
input17 AC 41 ms 1460 KB
1
input18 AC 39 ms 1280 KB
1
input19 AC 36 ms 1356 KB
1
input20 AC 34 ms 1436 KB
1
input21 AC 35 ms 1512 KB
1
input22 AC 25 ms 1332 KB
1
input23 AC 25 ms 1412 KB
1