Submission #206471

#TimeUsernameProblemLanguageResultExecution timeMemory
206471vardan__02Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <set>
#include <map>
#include "combo.h"
using namespace std;
string guess_sequence(int N)
{
    string ans="";
    string ban="ABXY";
    int v=0, x;
    x = press("A")
    if(x==1)
        v=0;
    x = press("B")
    if(x==1)
        v=1;
    x = press("X")
    if(x==1)
        v=2;
    x = press("Y")
    if(x==1)
        v=3;
    ans=ban[v];
    while(ans.size()!=N)
    {
        for(int i=0;i<=3;i++)
        {
        	if(i==v)
              continue;
            x = press(ans+ban[i]);
            if(x==ans.size()+1)
            {
                ans+=ban[i];
                break;
            }
        }
    }
    return ans;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:19: error: expected ';' before 'if'
   21 |     x = press("A")
      |                   ^
      |                   ;
   22 |     if(x==1)
      |     ~~             
combo.cpp:24:19: error: expected ';' before 'if'
   24 |     x = press("B")
      |                   ^
      |                   ;
   25 |     if(x==1)
      |     ~~             
combo.cpp:27:19: error: expected ';' before 'if'
   27 |     x = press("X")
      |                   ^
      |                   ;
   28 |     if(x==1)
      |     ~~             
combo.cpp:30:19: error: expected ';' before 'if'
   30 |     x = press("Y")
      |                   ^
      |                   ;
   31 |     if(x==1)
      |     ~~             
combo.cpp:34:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |     while(ans.size()!=N)
      |           ~~~~~~~~~~^~~
combo.cpp:41:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |             if(x==ans.size()+1)
      |                ~^~~~~~~~~~~~~~