結果
問題 |
No.112 ややこしい鶴亀算
|
ユーザー |
![]() |
提出日時 | 2020-08-15 04:16:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 821 bytes |
コンパイル時間 | 2,150 ms |
コンパイル使用メモリ | 198,380 KB |
最終ジャッジ日時 | 2025-01-13 01:00:25 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; #define rep2(i, a, n) for(int i = (a); i < (n); i++) #define rep(i, n) rep2(i,0,n) void out(){cout<<endl;} template<typename Head,typename... Tail> void out(Head&& head,Tail&&... tail){cout<<head<<" ";out(forward<Tail>(tail)...);} int main(){ cin.tie(nullptr);ios_base::sync_with_stdio(false); int n;cin>>n; int a,low=9999,high=0,sum=0; map<int, int> m; rep(i,n){ cin>>a; low = min(a, low); high = max(a, high); sum += a; m[a]++; //out(low,high,sum,m[low],m[high]); } //鶴亀少なくとも1匹づついる if (m.size() == 2){ cout << m[high] << " " << m[low] << endl; }else{ //亀のみ if (sum /n /n >= 2){ cout << 0 << " " << n << endl; //鶴のみ }else{ cout << n << " " << 0 << endl; } } }