제출 #755875

#제출 시각아이디문제언어결과실행 시간메모리
755875vjudge1Password (RMI18_password)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "C:\GCC\debug.h" #else #define debug(...) void(42) #endif int query(string str); /* int query(string str) { cout << str << endl; int x; cin >> x; return x; } */ string guess(int n, int s) { string endChars; vector<int> freq(s); for (int i = 0; i < s; i++) { string str; for (int it = 0; it < n; it++) { str += (i + 'a'); } freq[i] = query(str); if (freq[i] == n) { return str; } } string res; for (int i = 0; i < s; i++) { for (int j = 0; j < freq[i]; j++) { res += (i + 'a'); } } auto Build = [&](char i, char j) { string str; str += i; str += j; return str; }; sort(res.begin(), res.end(), [&](char i, char j) { if (i == j) { return 0; } return (query(Build(i, j)) == 2); }); return res; } /* int main() { guess(5, 5); } */

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

password.cpp: In lambda function:
password.cpp:55:32: error: inconsistent types 'int' and 'bool' deduced for lambda return type
   55 |     return (query(Build(i, j)) == 2);
      |            ~~~~~~~~~~~~~~~~~~~~^~~~~