結果
問題 |
No.349 干支の置き物
|
ユーザー |
![]() |
提出日時 | 2023-08-13 02:54:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 753 bytes |
コンパイル時間 | 1,020 ms |
コンパイル使用メモリ | 114,964 KB |
最終ジャッジ日時 | 2025-02-16 07:40:14 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 10 WA * 19 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:39:9: warning: ‘max1’ may be used uninitialized [-Wmaybe-uninitialized] 39 | if (max1 < mp[s]) max1 = mp[s]; | ^~ main.cpp:33:12: note: ‘max1’ was declared here 33 | int n, max1; | ^~~~
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<cctype> #include<set> #include<bitset> #include<math.h> #include<map> #include<queue> #include<iomanip> using namespace std; #ifdef _WIN32 #include <Windows.h> #endif int main() { map<string, int> mp; mp = { {"ne", 0}, {"ushi", 0}, {"tora", 0}, {"u", 0}, {"tatsu", 0}, {"mi", 0}, {"uma", 0}, {"hitsuji", 0}, {"saru", 0}, {"tori", 0}, {"inu", 0}, {"i", 0}, }; int n, max1; cin >> n; for (int i = 0; i < n; i++){ string s; cin >> s; mp[s]++; if (max1 < mp[s]) max1 = mp[s]; } cout << ((max1 > n - n/2) ? "NO" : "YES") << endl;; }