結果
問題 | No.24 数当てゲーム |
ユーザー |
|
提出日時 | 2016-03-25 21:01:09 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 931 bytes |
コンパイル時間 | 618 ms |
コンパイル使用メモリ | 67,144 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-02 00:50:21 |
合計ジャッジ時間 | 1,247 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <iostream> #include <string> #include <bitset> #include <vector> #include <cmath> using namespace std; int main() { int n, m; unsigned long long ans; string s; bitset<10> bitcheck, bittemp; bitcheck.set(); vector<int> vec; cin >>n; for (int i = 0; i < n; ++i) { for (int j = 0; j < 4; ++j) { cin >> m; vec.push_back(m); } cin >> s; if (s == "YES") { for (size_t k = 0; k < vec.size(); ++k) { bittemp.set(vec.at(k)); } } else if (s == "NO") { for (size_t k = 0; k <vec.size(); ++k) { bittemp.set(vec.at(k)); } bittemp.flip(); } bitcheck &= bittemp; bittemp.reset(); vec.clear(); } ans = static_cast<unsigned long long>(log2(bitcheck.to_ullong())); cout << ans << endl; return 0; }