제출 #162495

#제출 시각아이디문제언어결과실행 시간메모리
162495abacaba콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <string> #include <unordered_map> #include <cstring> #include <chrono> #include <vector> #include <map> #include <random> #include <set> #include <algorithm> #include <math.h> #include <cstdio> #include <stdio.h> #include <assert.h> #include <queue> #include <bitset> #include <cstdlib> #include <deque> #include <cassert> #include <stack> #include "combo.h" using namespace std; string seq[4] = {"A", "B", "X", "Y"}; int n, let1 = 3; string guess_sequence(int N) { srand(time(NULL)); vector <pair <string, int> > cur_seq = {{"A", 0}, {"B", 1}, {"X", 2}, {"Y", 3}}; random_shuffle(cur_seq.begin(), cur_seq.end()); let1 = cur_seq[3].se; for(int i = 0; i < 3; ++i) if(press(cur_seq[i].f)) { let1 = cur_seq[i].se; break; } string s = seq[let1]; swap(seq[3], seq[let1]); if(N == 1) return s; for(int i = 2; i < N; ++i) { string now = s + seq[0]; for(int j = 0; j < 3; ++j) now += s + seq[1] + seq[j]; int p = press(now); if(p == s.size()) s += seq[2]; else if(p == s.size() + 1) s += seq[0]; else s += seq[1]; } vector <string> cur = {seq[0], seq[1], seq[2]}; random_shuffle(cur.begin(), cur.end()); for(int i = 0; i < 2; ++i) if(press(s + cur[i]) == N) return s + cur[i]; return s + cur[2]; }

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:23: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'se'
   31 |     let1 = cur_seq[3].se;
      |                       ^~
combo.cpp:33:29: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'f'
   33 |         if(press(cur_seq[i].f)) {
      |                             ^
combo.cpp:34:31: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'se'
   34 |             let1 = cur_seq[i].se;
      |                               ^~
combo.cpp:47:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |         if(p == s.size())
      |            ~~^~~~~~~~~~~
combo.cpp:49:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |         else if(p == s.size() + 1)
      |                 ~~^~~~~~~~~~~~~~~