結果

問題 No.349 干支の置き物
ユーザー fmhrfmhr
提出日時 2016-04-01 22:18:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,553 bytes
コンパイル時間 1,571 ms
コンパイル使用メモリ 175,168 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-10 21:42:35
合計ジャッジ時間 2,788 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define _GLIBCXX_DEBUG
#define dump(c) cerr << "> " << #c << " = " << (c) << endl
#define all(c) ((c).begin()), ((c).end())
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define FOR(i,s,e) for(int (i)=(int)(s);(i)<(int)(e);++(i))
#define inf 0x3f3f3f3f
#define infl 0x3f3f3f3f3f3f3f3fLL

typedef long long ll;
typedef unsigned long long ull;

void print_array(int a[], int n){
    rep(i,n){if(i<n-1){cout<<a[i]<<" ";}else{cout<<a[i]<<endl;}}}
void print_vector(vector<int> v){rep(i,v.size()){if(i<(int)v.size()-1){cout<<v[i]<<" ";}else{cout<<v[i]<<endl;}}}

// vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v)
{int l = v.size();rep(i,l) {s<<v[i];if(i<l-1) s<<"\t";}return s;}
// 2 dimentional vector
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T> >&vv)
{rep(i,(int)vv.size()){s<<vv[i]<<endl;}return s;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    unordered_map<string,int>  eto;
    eto["ne"] = 0;
    eto["ushi"] = 0;
    eto["tora"] = 0;
    eto["u"] = 0;
    eto["tatsu"] = 0;
    eto["mi"] = 0;
    eto["uma"] = 0;
    eto["hitsuji"] = 0;
    eto["saru"] = 0;
    eto["tori"] = 0;
    eto["inu"] = 0;
    eto["i"] = 0;
    int m = 0;
    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        eto[s] ++;
        m = max(m, eto[s]);
    }
    if (m <= N/2 || (N%2==1 && m-1 <= N/2)){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}
0