Submission #00058


ソースコード

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
#include <bits/stdc++.h>
#define rep(i, x, n) for(int i=(x);i<(n);i++)
#define reps(i, x, n) for(int i=(x);i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7;
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;
//八方向を見るのに使うと便利(楽)
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
signed main(void){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int n;
cin >> n;
lol a[n + 5];
set<int> st;
reps(i, 1, n){
cin >> a[i];
st.insert(a[i]);
}
int ans = 1;
for(auto x : st){
int na, su;
na = su = 0;
if(a[1] >= x){
na ++;
}
reps(i, 2, n){
if(a[i - 1] < x + 1 && a[i] >= x + 1){
na ++;
}
}
ans = max({ans, na, su});
}
/*for(int i = n;i >= 0;i --){ //島がi個になるようにできるか調べる
}*/
cout << ans << '\n';
return 0;
}

ステータス

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

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
01-01.txt AC 22 ms 476 KB
1
2
3
01-02.txt AC 24 ms 560 KB
1
2
3
01-03.txt AC 17 ms 516 KB
1
2
3
01-04.txt AC 18 ms 596 KB
1
2
3
01-05.txt AC 17 ms 540 KB
1
2
3
01-06.txt AC 20 ms 608 KB
1
2
3
01-07.txt AC 25 ms 676 KB
1
2
3
01-08.txt WA 18 ms 688 KB
1
2
3
01-09.txt WA 24 ms 636 KB
1
2
3
01-10.txt AC 24 ms 744 KB
1
2
3
01-11.txt AC 26 ms 592 KB
1
2
3
01-12.txt WA 17 ms 536 KB
1
2
3
01-13.txt AC 31 ms 608 KB
1
2
3
01-14.txt AC 20 ms 676 KB
1
2
3
01-15.txt AC 27 ms 612 KB
1
2
3
01-16.txt AC 23 ms 552 KB
1
2
3
02-01.txt AC 20 ms 524 KB
2
3
02-02.txt AC 23 ms 480 KB
2
3
02-03.txt AC 23 ms 564 KB
2
3
02-04.txt AC 23 ms 640 KB
2
3
02-05.txt AC 20 ms 488 KB
2
3
02-06.txt AC 20 ms 436 KB
2
3
02-07.txt AC 23 ms 512 KB
2
3
02-08.txt WA 19 ms 708 KB
2
3
02-09.txt AC 20 ms 644 KB
2
3
02-10.txt AC 25 ms 716 KB
2
3
03-01.txt AC 219 ms 1108 KB
3
03-02.txt WA 31 ms 1416 KB
3
03-03.txt WA 21 ms 1364 KB
3
03-04.txt AC 32 ms 1316 KB
3
03-05.txt AC 50 ms 1388 KB
3
03-06.txt AC 260 ms 1460 KB
3
03-07.txt TLE 2000 ms 1872 KB
3
03-08.txt TLE 2000 ms 4420 KB
3
03-09.txt TLE 2000 ms 6140 KB
3
03-10.txt TLE 2000 ms 6136 KB
3
03-11.txt TLE 2000 ms 6132 KB
3
03-12.txt AC 32 ms 1388 KB
3
03-13.txt AC 25 ms 1460 KB
3
03-14.txt WA 34 ms 1408 KB
3
03-15.txt AC 35 ms 1356 KB
3
03-16.txt AC 73 ms 1432 KB
3
03-17.txt AC 253 ms 1504 KB
3
03-18.txt TLE 2000 ms 1908 KB
3
03-19.txt TLE 2000 ms 4456 KB
3
03-20.txt TLE 2000 ms 6052 KB
3
sample-01.txt AC 23 ms 672 KB
sample-02.txt AC 20 ms 760 KB
sample-03.txt AC 15 ms 848 KB