# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
554397 | OGheVaySao | Preokret (COCI19_preokret) | C++14 | 1 ms | 308 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e4;
int n, a[maxn], cnt = 1, maxtwist = 0;
map<int,int> mp;
void pre(){
for(int i = 1; i <= n; i++){
mp[a[i]]++;
if(mp[2] == mp[1]) cnt++;
}
}
void result(){
cout << mp[1] << " " << mp[2] << '\n';
}
void draw(){
cout << cnt << '\n';
}
void twist(){
int st = a[1];
int num = 0;
for(int i = 1; i <= n; i++){
if(a[i] == st) num++;
else{
st = a[i];
maxtwist = max(maxtwist, num);
num = 1;
}
}
maxtwist = max(maxtwist, num);
cout << maxtwist;
}
int main(){
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i];
}
pre();
result();
draw();
twist();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |