結果
| 問題 |
No.2153 何コーダーが何人?
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2022-12-10 16:40:18 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 774 bytes |
| コンパイル時間 | 896 ms |
| コンパイル使用メモリ | 71,168 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-14 23:46:47 |
| 合計ジャッジ時間 | 1,457 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 2153.cc: No.2153 何コーダーが何人? - yukicoder
*/
#include<cstdio>
#include<string>
#include<map>
#include<algorithm>
using namespace std;
/* constant */
const int MAX_L = 200;
const int C = 8;
/* typedef */
typedef map<string,int> msi;
/* global variables */
char s[MAX_L + 4];
int ss[C];
/* subroutines */
/* main */
int main() {
int n;
scanf("%d", &n);
msi scs;
for (int i = 0; i < n; i++) {
int ci;
scanf("%s%d", s, &ci);
string t(s);
msi::iterator mit = scs.find(t);
if (mit != scs.end()) {
ss[mit->second]--;
mit->second = ci;
ss[ci]++;
}
else {
scs[t] = ci;
ss[ci]++;
}
}
for (int i = 0; i < C; i++) printf("%d\n", ss[i]);
return 0;
}
tnakao0123