Submission #00056


ソースコード

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
54
55
56
57
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
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); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x) setprecision(x)
const long double PI=3.14159265358979323846264338327950;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
cin>>n;
vlong a(n);
rep(i,n){
cin>>a[i];
}
map<ll,int> M;
int cnt=0,fg=0,now=0;
bool fg2=false;
rep(i,n){
if(now>a[i] && fg==0){
M[now]--;
fg=1;
}
if(now<a[i] && fg==1){
M[now]++;
fg=0;
}
if(a[i]!=0){
fg2=true;
}
now=a[i];
}
int max=0;
for(auto x:M){
cnt+=x.second;
// cout<<x.first<<' '<<x.second<<'\n';
chmax(max,cnt);
}
if(fg2){
max++;
}
cout<<max<<'\n';
return(0);
}

ステータス

項目 データ
問題 0004 - 日本沈没 (Japan Sinks)
ユーザー名 ei1918
投稿日時 2020-12-08 17:52:38
言語 C++17
状態 Wrong Answer
得点 7
ソースコード長 1367 Byte
最大実行時間 50 ms
最大メモリ使用量 5656 KB

セット

セット 得点 Cases
1 Subtask1 7 / 7 01-*.txt
2 Subtask2 0 / 8 0[12]-*.txt
3 Subtask 0 / 85 0[123]-*.txt

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
01-01.txt AC 27 ms 604 KB
1
2
3
01-02.txt AC 19 ms 688 KB
1
2
3
01-03.txt AC 26 ms 520 KB
1
2
3
01-04.txt AC 22 ms 468 KB
1
2
3
01-05.txt AC 22 ms 656 KB
1
2
3
01-06.txt AC 27 ms 596 KB
1
2
3
01-07.txt AC 25 ms 776 KB
1
2
3
01-08.txt AC 28 ms 524 KB
1
2
3
01-09.txt AC 19 ms 588 KB
1
2
3
01-10.txt AC 23 ms 520 KB
1
2
3
01-11.txt AC 23 ms 580 KB
1
2
3
01-12.txt AC 24 ms 516 KB
1
2
3
01-13.txt AC 27 ms 576 KB
1
2
3
01-14.txt AC 21 ms 640 KB
1
2
3
01-15.txt AC 19 ms 568 KB
1
2
3
01-16.txt AC 25 ms 756 KB
1
2
3
02-01.txt AC 23 ms 608 KB
2
3
02-02.txt AC 20 ms 568 KB
2
3
02-03.txt AC 16 ms 400 KB
2
3
02-04.txt AC 16 ms 596 KB
2
3
02-05.txt AC 17 ms 568 KB
2
3
02-06.txt AC 21 ms 628 KB
2
3
02-07.txt AC 20 ms 824 KB
2
3
02-08.txt AC 20 ms 636 KB
2
3
02-09.txt WA 17 ms 696 KB
2
3
02-10.txt AC 19 ms 748 KB
2
3
03-01.txt AC 22 ms 1124 KB
3
03-02.txt AC 26 ms 1352 KB
3
03-03.txt AC 30 ms 1420 KB
3
03-04.txt AC 30 ms 1352 KB
3
03-05.txt WA 33 ms 1548 KB
3
03-06.txt AC 27 ms 1476 KB
3
03-07.txt AC 36 ms 1864 KB
3
03-08.txt AC 37 ms 4248 KB
3
03-09.txt AC 50 ms 5528 KB
3
03-10.txt AC 29 ms 1416 KB
3
03-11.txt AC 27 ms 1480 KB
3
03-12.txt AC 29 ms 1420 KB
3
03-13.txt AC 36 ms 1488 KB
3
03-14.txt AC 29 ms 1424 KB
3
03-15.txt AC 30 ms 1488 KB
3
03-16.txt AC 31 ms 1552 KB
3
03-17.txt AC 29 ms 1608 KB
3
03-18.txt AC 40 ms 2124 KB
3
03-19.txt AC 47 ms 4508 KB
3
03-20.txt WA 45 ms 5656 KB
3
sample-01.txt AC 17 ms 788 KB
sample-02.txt AC 20 ms 616 KB
sample-03.txt AC 17 ms 700 KB