結果

問題 No.2153 何コーダーが何人?
ユーザー mo124121
提出日時 2022-11-25 05:49:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 2,035 ms
コンパイル使用メモリ 199,220 KB
最終ジャッジ日時 2025-02-08 23:37:56
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main()
{
    int N;
    vector<string> S;
    vector<int> C;
    cin >> N;
    rep(i, N)
    {
        int c;
        string s;
        cin >> s >> c;
        auto itr = std::find(S.begin(), S.end(), s);
        if (itr == S.end())
            S.push_back(s), C.push_back(c);
        else
        {
            int i = std::distance(S.begin(), itr);
            C[i] = c;
        }
    }
    int ans[] = {0, 0, 0, 0, 0, 0, 0, 0};
    for (const auto &c : C)
    {
        ans[c] += 1;
    }
    for (const auto &a : ans)
    {
        cout << a << endl;
    }

    return 0;
}
0