Submission #140266

#TimeUsernameProblemLanguageResultExecution timeMemory
140266Runtime_error_Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
 
string guess_sequence(int N) {
 
    vector<char>v;
    string ans = "";
    if( press("AB") )
        ans += ( press("A") ? 'A' : 'B' );
    else
        ans += ( press("X") ? 'X' : 'Y');
 
    if(ans[0] != 'A')
        v.push_back('A');
    if(ans[0] != 'B')
        v.push_back('B');
    if(ans[0] != 'X')
        v.push_back('X');
    if(ans[0] != 'Y')
        v.push_back('Y');
 if(N==1)
   return ans;
    for(int i=2;i<N;i++){
        string tmp = ans+v[0] + ans+v[1]+v[0] + ans+v[1]+v[1] + ans+v[1]+v[2];
        int res = press(tmp);
        if( res == i-1 )
            ans += v[2];
        else if( res == i+1 )
            ans += v[1];
        else
            ans += v[0];
    }
    if( press( ans+v[0] ) == N )
        ans += v[0];
    else if( press( ans+v[1] ) == N)
        ans += v[1];
    else
        ans += v[2];
    return ans;
}

Compilation message (stderr)

combo.cpp:23:2: error: extended character   is not valid in an identifier
   23 |    return ans;
      |  ^
combo.cpp:24:2: error: extended character   is not valid in an identifier
   24 |     for(int i=2;i<N;i++){
      |  ^
combo.cpp:24:5: error: extended character   is not valid in an identifier
   24 |     for(int i=2;i<N;i++){
      |    ^
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:2: error: '\U000000a0' was not declared in this scope
   23 |    return ans;
      |  ^
combo.cpp:24:2: error: '\U000000a0' was not declared in this scope
   24 |     for(int i=2;i<N;i++){
      |  ^
combo.cpp:24:19: error: 'i' was not declared in this scope
   24 |     for(int i=2;i<N;i++){
      |                 ^