Submission #00039


ソースコード

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
#include<bits/stdc++.h>
using namespace std;
#define INF (1<<29)//INF
#define F first
#define S second
#define VS vector<string>
#define VI vector<int>
#define REPI(i,s,n) for(int i=s;i<n;i++)//sからn未満の間iを回す
#define REPJ(j,s,n) for(int j=s;j<n;j++)//sからn未満の間iを回す
#define RREPI(i,s,n) for(int i=s;i>=n;i--)//sからn以下の間iを回す
#define RREPJ(j,s,n) for(int j=s;j>=n;j--)//sからn以下の間jを回す
#define ALL(a) a.begin(),a.end()//ソートとかに使える sort(ALL(vec))のように
#define SET(a,c) memset(a,c,sizeof(a));//aをc(0or1)で初期化する
#define DEBUGONE(x) cout<<#x<<" : "<<x<<endl;//デバックで一つの変数を表示
#define DEBUGTWO(x,y) cout<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl;//デバックで二つの変数を表示
#define DEBUGTHREE(x,y,z) cout<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl;//デバックで三つの変数を表示
#define OUTONE(x) cout<<x<<endl;//一つの変数を表示
#define OUTTWO(x,y) cout<<x<<" "<<y<<endl;//二つの変数を表示
#define OUTTHREE(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl;//三つの変数を表示
typedef long long int64;
typedef pair<string,int> Psi;
typedef pair<int,int> Pii;
main(){
int n;
int ruiseki[100001]={0};
cin>>n;
int a,b;
int p=1;
cin>>b;
ruiseki[0]=0;
ruiseki[1]=1;
REPI(i,0,n-1){
cin>>a;
if(b==a){
p++;
}
b=a;
ruiseki[p]++;
}
p++;
ruiseki[p]=0;
int ans=0;
REPI(i,1,p){
ans=max(ans,ruiseki[i-1]+ruiseki[i]+ruiseki[i+1]);
}
OUTONE(ans);
}

ステータス

項目 データ
問題 0004 - 電飾
ユーザー名 ei1417
投稿日時 2015-12-04 15:36:30
言語 C++11
状態 Accepted
得点 100
ソースコード長 1612 Byte
最大実行時間 26 ms
最大メモリ使用量 1140 KB

セット

セット 得点 Cases
1 INPUT1 10 / 10 01-*
2 INPUT2 10 / 10 02-*
3 INPUT3 20 / 20 03-*
4 INPUT4 60 / 60 04-*

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
01-01.txt AC 11 ms 856 KB
1
01-02.txt AC 14 ms 828 KB
1
01-03.txt AC 11 ms 936 KB
1
01-04.txt AC 11 ms 776 KB
1
01-05.txt AC 14 ms 744 KB
1
01-06.txt AC 13 ms 844 KB
1
01-07.txt AC 12 ms 948 KB
1
01-08.txt AC 12 ms 916 KB
1
02-01.txt AC 14 ms 884 KB
2
02-02.txt AC 15 ms 860 KB
2
02-03.txt AC 13 ms 832 KB
2
02-04.txt AC 12 ms 932 KB
2
02-05.txt AC 15 ms 1028 KB
2
02-06.txt AC 14 ms 876 KB
2
02-07.txt AC 12 ms 856 KB
2
02-08.txt AC 14 ms 956 KB
2
03-01.txt AC 16 ms 932 KB
3
03-02.txt AC 12 ms 904 KB
3
03-03.txt AC 13 ms 872 KB
3
03-04.txt AC 13 ms 844 KB
3
03-05.txt AC 14 ms 812 KB
3
03-06.txt AC 13 ms 920 KB
3
03-07.txt AC 13 ms 888 KB
3
03-08.txt AC 14 ms 988 KB
3
04-01.txt AC 15 ms 956 KB
4
04-02.txt AC 18 ms 1056 KB
4
04-03.txt AC 19 ms 1028 KB
4
04-04.txt AC 24 ms 1000 KB
4
04-05.txt AC 25 ms 1100 KB
4
04-06.txt AC 24 ms 1068 KB
4
04-07.txt AC 24 ms 1040 KB
4
04-08.txt AC 26 ms 1140 KB
4