結果
問題 | No.112 ややこしい鶴亀算 |
ユーザー |
![]() |
提出日時 | 2020-11-23 11:01:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 567 bytes |
コンパイル時間 | 1,472 ms |
コンパイル使用メモリ | 167,412 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-23 17:22:52 |
合計ジャッジ時間 | 2,293 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
#include<bits/stdc++.h> //#include<atcoder/all> using namespace std; //using namespace atcoder; int main(){ int N; cin>>N; int a[N]; bool same=true; int mx=0; for(int i=0;i<N;i++){ cin>>a[i]; if(i>=1&&a[i-1]!=a[i]) same=false; mx=max(mx,a[i]); } if(same){ if(a[0]==2*(N-1)) cout<<N<<" 0"<<endl; else cout<<"0 "<<N<<endl; } else{ int k=0,t=0; for(int i=0;i<N;i++){ if(mx==a[i]) t++; else k++; } cout<<t<<" "<<k<<endl; } }