제출 #419246

#제출 시각아이디문제언어결과실행 시간메모리
419246peuch콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { vector<string> ord[4] = {"A", "B", "X", "Y"}; if(press("AB")){ if(press("A")) swap(ord[0], ord[0]); else swap(ord[0], ord[1]); } else{ if(press("X")) swap(ord[0], ord[2]); else swap(ord[0], ord[3]); } for(int i = 2; i < N; i++){ string guess = ans + ord[1]; guess = guess + ans + ord[2] + ord[1]; guess = guess + ans + ord[2] + ord[2]; guess = guess + ans + ord[2] + ord[3]; int cnt = press(guess); if(cnt == i) ans = ans + ord[1]; else if(cnt == i + 1) ans = ans + ord[2]; else ans = ans + ord[3]; } if(press(ans + ord[1]) == N) return ans + ord[1]; if(press(ans + ord[2]) == N) return ans + ord[2]; return ans + ord[3]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:27: error: conversion from 'const char [2]' to non-scalar type 'std::vector<std::__cxx11::basic_string<char> >' requested
    6 |  vector<string> ord[4] = {"A", "B", "X", "Y"};
      |                           ^~~
combo.cpp:6:32: error: conversion from 'const char [2]' to non-scalar type 'std::vector<std::__cxx11::basic_string<char> >' requested
    6 |  vector<string> ord[4] = {"A", "B", "X", "Y"};
      |                                ^~~
combo.cpp:6:37: error: conversion from 'const char [2]' to non-scalar type 'std::vector<std::__cxx11::basic_string<char> >' requested
    6 |  vector<string> ord[4] = {"A", "B", "X", "Y"};
      |                                     ^~~
combo.cpp:6:42: error: conversion from 'const char [2]' to non-scalar type 'std::vector<std::__cxx11::basic_string<char> >' requested
    6 |  vector<string> ord[4] = {"A", "B", "X", "Y"};
      |                                          ^~~
combo.cpp:16:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |   string guess = ans + ord[1];
      |                  ^~~
      |                  abs
combo.cpp:25:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |  if(press(ans + ord[1]) == N) return ans + ord[1];
      |           ^~~
      |           abs
combo.cpp:26:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |  if(press(ans + ord[2]) == N) return ans + ord[2];
      |           ^~~
      |           abs
combo.cpp:27:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |  return ans + ord[3];
      |         ^~~
      |         abs