Submission #770724

#TimeUsernameProblemLanguageResultExecution timeMemory
770724AtinaR콤보 (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
std::string guess_sequence(int N)
{
    char first;
    int f=press("AB");
    if(f>=1)
    {
        f=press("A");
        if(f>=1)
        {
            first='A';
        }
        else
        {
            first='B';
        }
    }
    else
    {
        f=press("X");
        if(f>=1)
        {
            first='X';
        }
        else first='Y';
    }
    string res="";
    res+=first;
    char a,b,c;
    if(first=='X')
    {
        a='A';
        b='B';
        c='Y';
    }
    else if(first=='Y')
    {
        a='A';
        b='B';
        c='X';
    }
    else if(first=='A')
    {
        a='X';
        b='B';
        c='Y';
    }
    else if(first=='B')
    {
        a='A';
        b='X';
        c='Y';
    }
    for(int sz=1; sz<n-1; sz++)
    {
        string cnt=res+a+  res+b+a + res+b+b + res+b+c;
        int tmp=press(cnt);
        if(tmp==sz+1)
        {
            res+=a;
        }
        else if(tmp==sz+2)
        {
            res+=b;
        }
        else if(tmp==sz.size())
        {
            res+=c;
        }
    }
    int tmp;
    if(press(res+a)==N)
    {
        res+=a;
    }
    else if(press(res+b)==N)
    {
        res+=b;
    }
    else
    {
        res+=c;
    }
    return res;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:56:22: error: 'n' was not declared in this scope
   56 |     for(int sz=1; sz<n-1; sz++)
      |                      ^
combo.cpp:68:25: error: request for member 'size' in 'sz', which is of non-class type 'int'
   68 |         else if(tmp==sz.size())
      |                         ^~~~
combo.cpp:73:9: warning: unused variable 'tmp' [-Wunused-variable]
   73 |     int tmp;
      |         ^~~