-
Notifications
You must be signed in to change notification settings - Fork 0
/
DAYCON.cpp
37 lines (35 loc) · 834 Bytes
/
DAYCON.cpp
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
#include <bits/stdc++.h>
using namespace std;
int main(){
/*INIT*/
freopen("DAYCON.INP", "r", stdin);
freopen("DAYCON.OUT", "w", stdout);
int n, ans = 0;
/*CONSTRUCT ARRAY*/
scanf("%d", &n);
int *a = new int [n + 1];
/*READ*/
for (int i = 1; i <= n; ++i){
scanf("%d", &a[i]);
}
/*PROCESS*/
for (int i = 1; i <= n; ++i){
int prev = 1005,
temp = 1;
for (int j = 1; j <= n; ++j){
if (a[i] != a[j]){
if (prev == a[j]) ++temp;
else{
ans = max(ans, temp);
temp = 1;
prev = a[j];
}
}
}
if (prev != 1005) ans = max(ans, temp);
}
printf("%d", ans);
/*DESTRUCTOR*/
delete [] a;
return 0;
}