Submission #428381

#TimeUsernameProblemLanguageResultExecution timeMemory
428381SAADCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#define F first #define S second #define rep(i,a,b) for(int i=a;!(a==b&&i!=b)&&((i<=b&&b>=a)||(i>=b&&a>=b));i+=(a<=b?1:-1)) #define pb push_back #define Fbitl __builtin_ffs #define bit1 __builtin_popcount //#include <bits/stdc++.h> #include <iostream> #include <math.h> #include <algorithm> #include <string.h> #include <vector> #include <queue> #include <map> #include <unordered_map> //#include "friend.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<string, string> pss; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vii; typedef vector<ll> vl; typedef vector<vl> vvl; //press(string); string sw = " ABXY" ; int fidx ; string guess_sequence(int N) { if ( press("ABA") ) { if ( press("B") ) fidx = 2 ; else fidx = 1 ; } else { if ( press("X") ) fidx = 3 ; else fidx = 4 ; } string res = { sw[fidx] } , t ; if ( N == 1 ) return sw[fidx] ; for (int j = 1;j<n;j++) { t += ' '; for ( int i = 1 ; i <= 4 ; i++ ) { if ( i == fidx ) continue; if ( i == 4 || (i == 3&&fidx==4)) { res += sw[i]; break; } t[j] = sw[i]; if ( press(t) == j+1 ) { res += sw[i]; break; } } } return res; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:10: error: 'press' was not declared in this scope; did you mean 'pss'?
   31 |     if ( press("ABA") ) {
      |          ^~~~~
      |          pss
combo.cpp:40:33: error: could not convert 'sw.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)fidx))' from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   40 |     if ( N == 1 ) return sw[fidx] ;
      |                                 ^
      |                                 |
      |                                 __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
combo.cpp:41:22: error: 'n' was not declared in this scope
   41 |     for (int j = 1;j<n;j++) {
      |                      ^
combo.cpp:50:18: error: 'press' was not declared in this scope; did you mean 'res'?
   50 |             if ( press(t) == j+1 ) {
      |                  ^~~~~
      |                  res