結果
問題 | No.24 数当てゲーム |
ユーザー | MATSUMAT |
提出日時 | 2018-10-07 22:31:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 633 bytes |
コンパイル時間 | 1,720 ms |
コンパイル使用メモリ | 175,520 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 14:19:16 |
合計ジャッジ時間 | 2,116 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:39, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ccomplex:39, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54, from main.cpp:1: In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]', inlined from 'int main()' at main.cpp:38:11: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized] 202 | { return _M_insert(__n); } | ~~~~~~~~~^~~~~ main.cpp: In function 'int main()': main.cpp:4:15: note: 'ans' was declared here 4 | long long n,ans,MAX=-1; | ^~~
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ long long n,ans,MAX=-1; string s; cin >> n; bool f[10]; map<long long,int> mp; for(int i=0;i<10;i++){ f[i]=true; } long long a[4]; for(int i=0;i<n;i++){ for(int j=0;j<4;j++){ cin >> a[j]; } cin >> s; if(s=="NO"){ for(int j=0;j<4;j++){ f[a[j]]=false; } }else{ for(int j=0;j<4;j++){ if(f[a[j]]){ mp[a[j]]++; } } } } for(int i=0;i<10;i++){ if(f[i]){ if(MAX<mp[i]){ ans=i; MAX=mp[i]; } } } cout << ans << endl; return 0; }