結果

問題 No.112 ややこしい鶴亀算
ユーザー kekenx
提出日時 2020-04-04 20:29:55
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 537 bytes
コンパイル時間 1,717 ms
コンパイル使用メモリ 174,404 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-03 07:42:11
合計ジャッジ時間 2,436 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  set<int> st;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    st.insert(a[i]);
  }

  if (st.size() == 1) {
    if (a[0] / 2 == n - 1) {
      cout << n << " " << 0 << '\n';
    } else {
      cout << 0 << " " << n << '\n';
    }
  } else {
    int mi = *st.begin();
    int t = 0;
    for (int i = 0 ; i < n; ++i) {
      if (a[i] == mi) t++;
    }
    cout << n - t <<  " " << t << '\n';
  }
  return 0;
}
0