제출 #749960

#제출 시각아이디문제언어결과실행 시간메모리
749960CDuong콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
/*
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,fma,bmi,bmi2,sse4.2,popcnt,lzcnt")
*/

#include <bits/stdc++.h>
#include "combo.h"
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
using namespace std;

const int mxN = 2e5 + 5;
const int mod = 1e9 + 7;
const ll oo = 1e18;

char c[] = {'A', 'B', 'X', 'Y'};

string guess_sequence(int N) {
    int n = N;
    int cur = press("AB");
    string s;
    if(cur == 1) {
        cur = press("A");
        if(cur) s = "A";
        else s = "B";
    }
    else {
        cur = press("X");
        if(cur) s = "X";
        else s = "Y";
    }

    vector<char> sadge;
    for(int i = 0; i < 4; ++i)
        if(c[i] != s[0])
            sadge.emplace_back(c[i]);
    
    for(int i = (int)s.size(); i < n - 1; ++i) {
        tmp += s;
        tmp.pb(s[0]);
        tmp.pb(s[0]);
        tmp += s;
        tmp.pb(s[0]);
        tmp.pb(s[1]);
        tmp += s;
        tmp.pb(s[0]);
        tmp.pb(s[2]);
        tmp += s;
        tmp.pb(s[1]);
        int cur = press(tmp);
        if(tmp == i) s.pb(s[2]);
        else if(tmp - 1 == i) s.pb(s[1]);
        else s.pb(s[0]);
    }
    string tmp = s;
    tmp.pb(s[0]);
    if(press(tmp)) {
        s.pb(s[0]);
        return s;
    }
    tmp.pop_back();
    tmp.pb(s[1]);
    if(press(tmp)) {
        s.pb(s[1]);
        return s;
    }
    s.pb(s[2]);
    return s;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:48:9: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   48 |         tmp += s;
      |         ^~~
      |         tm
combo.cpp:59:13: warning: unused variable 'cur' [-Wunused-variable]
   59 |         int cur = press(tmp);
      |             ^~~