結果

問題 No.112 ややこしい鶴亀算
ユーザー GOTKAKO
提出日時 2025-07-03 21:36:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 520 bytes
コンパイル時間 1,981 ms
コンパイル使用メモリ 200,488 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-07-03 21:36:21
合計ジャッジ時間 2,918 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int N; cin >> N;
    map<int,int> M;
    while(N--){
        int a; cin >> a;
        M[a]++;
    }
    if(M.size() == 1){
        auto [k,v] = *M.begin();
        if(v*2-2 == k) cout << v << " " << 0 << endl;
        else cout << 0 << " " << v << endl; 
    }
    else{
        auto [ign,v0] = *M.begin();
        auto [IGN,v1] = *M.rbegin();
        cout << v1 << " " << v0 << endl;
    }
}
0