답안 #495992

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
495992 2021-12-20T10:21:11 Z asandikci Preokret (COCI19_preokret) C++17
44 / 50
1 ms 296 KB
#include"iostream"
#include"vector"
// #include"queue"
// #include"deque"
#include"set"
// #include"map"
#include"algorithm"
// #include"iomanip"
// #include"cstring"
#define int long long
using namespace std;  


void solve(){
  int n;
  cin >> n;
  int a=0,b=0,tmp,tie=1,turna=0,turnb=0;
  bool ta=0,tb=0;
  int maxi=0;
  for(int i=0;i<n;i++){
    cin >> tmp;
    if(tmp==1){
      if(a<b){
        ta=1;
      }
      if(ta){
        turna++;
      }
      a++;
      turnb=0;
      tb=0;
      maxi = max(maxi,turna);
    }
    else{
      if(b<a){
        tb=1;
      }
      if(tb){
        turnb++;
      }
      turna=0;
      ta=0;
      b++;
      maxi = max(maxi,turnb);
    }
    if(a==b){
      tie++;
    }
  }
  cout << a << " " << b << "\n";
  cout << tie << "\n";
  cout << maxi <<"\n";
}

signed main(){
  // ios::sync_with_stdio(false); cin.tie(0);
  // freopen("","r",stdin);freopen("","w",stdout);
  int t=1;
  // cin >> t;
  for(int i=1;i<=t;i++){
    // cout << "Case " << i << ":\n";
    solve();
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 296 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 292 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Partially correct 0 ms 208 KB Output is partially correct
8 Correct 1 ms 208 KB Output is correct
9 Partially correct 1 ms 208 KB Output is partially correct
10 Correct 1 ms 208 KB Output is correct