結果

問題 No.2925 2-Letter Shiritori
ユーザー VvyLwVvyLw
提出日時 2024-10-14 13:02:42
言語 C++23(gcc13)
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,115 bytes
コンパイル時間 1,513 ms
コンパイル使用メモリ 119,572 KB
実行使用メモリ 25,452 KB
平均クエリ数 13.33
最終ジャッジ日時 2024-10-14 13:02:51
合計ジャッジ時間 4,731 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#ifdef local
#include <C++/core/io/debug_print.hpp>
#else
#define dump(...) void(0);
#endif

#include <iostream>
#include <ranges>
#include <cassert>
#include <unordered_set>
namespace man {

}
int main() {
    std::cin.tie(nullptr) -> sync_with_stdio(false);
    using namespace std::views;
    char a;
    std::cin >> a;
    std::unordered_set<std::string> t;
    while(true) {
        std::string s;
        s += a;
        for(const auto c: iota('a', 'z' + 1)) {
            s += c;
            if(t.contains(s)) {
                s.pop_back();
            } else {
                std::cout << "? " << s << std::endl;
                break;
            }
        }
        if(std::ssize(t) == 51) {
            break;
        }
        char dummy;
        std::cin >> dummy >> s;
        assert(std::ssize(s) == 2);
        if(t.contains(s)) {
            break;
        }
        t.emplace(s);
        a = s.back();
    }
    std::cout << "! WIN" << std::endl;
}
0