제출 #903897

#제출 시각아이디문제언어결과실행 시간메모리
903897zhasyn콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> #define pb push_back #define pf push_front using namespace std; #define F first #define S second typedef long long ll; #define pii pair <int, int> #define pll pair <ll, ll> typedef long double ld; const ll N = 2 * 1e5 + 10, len = 316; const ll mod = 1e9 + 7; ll um(ll a, ll b){ return ((1LL * a * b) % mod + mod) % mod; } ll subr(ll a, ll b){ return ((1LL * a - b) % mod + mod) % mod; } string guess_sequence(int n){ string s = "ABXY"; int fir; if(press("AB") >= 1){ if(press("A") == 1) fir = 0; else fir = 1; } else{ if(press("X") == 1) fir = 2; else fir = 3; } string ans = s[fir]; for(int i = 1; i < n; i++){ int cnt = 0; for(int j = 0; j < 4; j++){ if(j == fir) continue; if(cnt == 2){ ans += s[j]; break; } int k = press(ans + s[j]); cnt++; if(k == i + 1){ ans += s[j]; break; } } } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:20: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   31 |  string ans = s[fir];
      |                    ^