結果

問題 No.112 ややこしい鶴亀算
ユーザー NullKaraNullKara
提出日時 2020-11-23 11:00:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 561 bytes
コンパイル時間 2,995 ms
コンパイル使用メモリ 165,408 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-30 23:41:45
合計ジャッジ時間 3,008 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 WA -
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 WA -
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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]==4) 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;
    }


}
0