제출 #546516

#제출 시각아이디문제언어결과실행 시간메모리
546516srivatsav_kannanCombo (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <fstream> #include <vector> #include <set> #include <queue> #include <cmath> #include <map> #include <algorithm> #include <numeric> #include <stack> #include <cstring> #include <bitset> #include <climits> #include <valarray> #include <list> #include "combo.h" //#define int long long #define INF 1000000000 #define endl '\n' #define mod 1000000007 using namespace std; vector<string> all; string ar[4] = {"A", "B", "X", "Y"}; void fills(string cur){ if (cur.size() == 3) all.push_back(cur); for (int j = 0; j < 4; j++){ if (ar[j][0] == cur[0]) continue; string temp = cur; temp += ar[j][0]; fills(temp); } } string guess_sequence(signed n){ if (n == 3){ fills(""); for (int i = 0; i < all.size(); i++) { if (press[all[i]] == 3) return all[i]; } } string ans; for (int i = 0; i < n; i++){ for (int j = 0; j < 4; j++) { if (press(ar[j]) == 1) { ans += ar[j]; break; } } } return ans; } //signed main(){ // ios_base::sync_with_stdio(false); // cin.tie(0); // cout.tie(0); // //}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:36:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         for (int i = 0; i < all.size(); i++) {
      |                         ~~^~~~~~~~~~~~
combo.cpp:37:22: error: no match for 'operator[]' (operand types are 'int(std::string)' {aka 'int(std::__cxx11::basic_string<char>)'} and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'})
   37 |             if (press[all[i]] == 3) return all[i];
      |                      ^