题解:AT1202Contest_b vs. DEGwer

· · 题解

include <iostream>

include <string>

using namespace std; int main() { int H, W; string move; cin >> H >> W >> move;

// 只有当H=2, W=1且我方先行时,才有必胜策略
if (H == 2 && W == 1 && move == "First") {
    cout << "Yes" << endl;
    cout.flush();

    // 第一步:打开中间的纵向门
    cout << "- 1 1" << endl;
    cout.flush();

    // 读取DEGwer的回应
    char t;
    int i, j;
    cin >> t >> i >> j;

    // 第二步:打开右侧的第二个出口门
    cout << "| 2 2" << endl;
    cout.flush();

    // 读取最终结果(不需要处理,程序会自动终止)
    cin >> t >> i >> j;
} else {
    // 其他情况都无法保证必胜
    cout << "No" << endl;
    cout.flush();
}

return 0;

}