Submission #78014

# Submission time Handle Problem Language Result Execution time Memory
78014 2018-10-01T19:25:26 Z MladenP Combo (IOI18_combo) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "combo.h"
#define STIZE(x) fprintf(stderr, "STIZE%d\n", x);
#define PRINT(x) fprintf(stderr, "%s = %d\n", #x, x);
#define NL(x) printf("%c", " \n"[(x)]);
#define lld long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mid (l+r)/2
#define endl '\n'
#define all(a) begin(a),end(a)
#define sz(a) int((a).size())
#define LINF 1000000000000000LL
#define INF 1000000000
#define EPS 1e-9
using namespace std;
set<char> s;
string guess_sequence(int N) {
    string P = "";
    if(press("AB") >= 1) {
        if(press("A")) P += 'A';
        else P += 'B';
    } else {
        if(press("X")) P += 'X';
        else P += 'Y';
    }
    s.insert('A'); s.insert('B'); s.insert('X'); s.insert('Y');
    s.erase(P[0]);
    string A = *s.begin(); s.erase(A);
    string B = *s.begin(); s.erase(B);
    string C = *s.begin(); s.erase(C);
    while(sz(P) < N-1) {
        int cur = press(P+A+A+P+A+B+P+A+C+P+B);
        if(cur == sz(P)) P += C;
        if(cur == sz(P)+1) P += B;
        if(cur == sz(P)+2) P += A;
    }
    if(N != 1) {
        if(press(A+B)) {
            if(press(A)) P += A;
            else P += B;
        } else P += C;
    }
    return P;
}


Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:16: error: conversion from 'const char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   31 |     string A = *s.begin(); s.erase(A);
      |                ^~~~~~~~~~
combo.cpp:31:37: error: no matching function for call to 'std::set<char>::erase(std::string&)'
   31 |     string A = *s.begin(); s.erase(A);
      |                                     ^
In file included from /usr/include/c++/10/set:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_set.h:654:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = char; _Compare = std::less<char>; _Alloc = std::allocator<char>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator]'
  654 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/10/bits/stl_set.h:654:28: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::set<char>::const_iterator' {aka 'std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator'}
  654 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/10/bits/stl_set.h:684:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::erase(const key_type&) [with _Key = char; _Compare = std::less<char>; _Alloc = std::allocator<char>; std::set<_Key, _Compare, _Alloc>::size_type = long unsigned int; std::set<_Key, _Compare, _Alloc>::key_type = char]'
  684 |       erase(const key_type& __x)
      |       ^~~~~
/usr/include/c++/10/bits/stl_set.h:684:29: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const key_type&' {aka 'const char&'}
  684 |       erase(const key_type& __x)
      |             ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_set.h:706:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator, std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = char; _Compare = std::less<char>; _Alloc = std::allocator<char>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator]'
  706 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/10/bits/stl_set.h:706:7: note:   candidate expects 2 arguments, 1 provided
combo.cpp:32:16: error: conversion from 'const char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   32 |     string B = *s.begin(); s.erase(B);
      |                ^~~~~~~~~~
combo.cpp:32:37: error: no matching function for call to 'std::set<char>::erase(std::string&)'
   32 |     string B = *s.begin(); s.erase(B);
      |                                     ^
In file included from /usr/include/c++/10/set:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_set.h:654:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = char; _Compare = std::less<char>; _Alloc = std::allocator<char>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator]'
  654 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/10/bits/stl_set.h:654:28: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::set<char>::const_iterator' {aka 'std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator'}
  654 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/10/bits/stl_set.h:684:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::erase(const key_type&) [with _Key = char; _Compare = std::less<char>; _Alloc = std::allocator<char>; std::set<_Key, _Compare, _Alloc>::size_type = long unsigned int; std::set<_Key, _Compare, _Alloc>::key_type = char]'
  684 |       erase(const key_type& __x)
      |       ^~~~~
/usr/include/c++/10/bits/stl_set.h:684:29: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const key_type&' {aka 'const char&'}
  684 |       erase(const key_type& __x)
      |             ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_set.h:706:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator, std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = char; _Compare = std::less<char>; _Alloc = std::allocator<char>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator]'
  706 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/10/bits/stl_set.h:706:7: note:   candidate expects 2 arguments, 1 provided
combo.cpp:33:16: error: conversion from 'const char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   33 |     string C = *s.begin(); s.erase(C);
      |                ^~~~~~~~~~
combo.cpp:33:37: error: no matching function for call to 'std::set<char>::erase(std::string&)'
   33 |     string C = *s.begin(); s.erase(C);
      |                                     ^
In file included from /usr/include/c++/10/set:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_set.h:654:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = char; _Compare = std::less<char>; _Alloc = std::allocator<char>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator]'
  654 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/10/bits/stl_set.h:654:28: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::set<char>::const_iterator' {aka 'std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator'}
  654 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/10/bits/stl_set.h:684:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::erase(const key_type&) [with _Key = char; _Compare = std::less<char>; _Alloc = std::allocator<char>; std::set<_Key, _Compare, _Alloc>::size_type = long unsigned int; std::set<_Key, _Compare, _Alloc>::key_type = char]'
  684 |       erase(const key_type& __x)
      |       ^~~~~
/usr/include/c++/10/bits/stl_set.h:684:29: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const key_type&' {aka 'const char&'}
  684 |       erase(const key_type& __x)
      |             ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_set.h:706:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator, std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = char; _Compare = std::less<char>; _Alloc = std::allocator<char>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>, std::allocator<char> >::const_iterator]'
  706 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/10/bits/stl_set.h:706:7: note:   candidate expects 2 arguments, 1 provided