제출 #336594

#제출 시각아이디문제언어결과실행 시간메모리
336594ljuba콤보 (IOI18_combo)C++17
0 / 100
1 ms200 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

string guess_sequence(int n) {
    string ans;
    if(press("AB")) {
        if(press("A"))
            ans += 'A';
        else
            ans += 'B';
    } else if(press("X")) {
        ans += 'X';
    } else {
        ans += 'Y';
    }

    if(n <= 1)
        return ans;
    vector<char> kar;
    if(ans != "A")
        kar.push_back('A');
    if(ans != "B")
        kar.push_back('B');
    if(ans != "X")
        kar.push_back('X');
    if(ans != "Y");
        kar.push_back('Y');

    for(auto z : kar)
        cout << z << "\n";

    for(int i = 1; i < n-1; ++i) {
        string s = ans + kar[0] + ans + kar[1] + kar[0] + ans + kar[1] + kar[1] + ans + kar[1] + kar[2];
        cout << s << endl;
        int x = press(s) - i;
        if(x == 0) {
            ans += kar[2];
        } else if(x == 1) {
            ans += kar[0];
        } else {
            ans += kar[1];
        }
    }

    if(press(ans+kar[0]) == n) {
        ans += kar[0];
    } else if(press(ans+kar[1]) == n) {
        ans += kar[1];
    } else {
        ans += kar[2];
    }

    cout << ans << endl;

    return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   28 |     if(ans != "Y");
      |     ^~
combo.cpp:29:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   29 |         kar.push_back('Y');
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...