제출 #1156795

#제출 시각아이디문제언어결과실행 시간메모리
1156795SmuggingSpunPassword (RMI18_password)C++17
0 / 100
131 ms416 KiB
#include<bits/stdc++.h> using namespace std; int query(string q); string guess(int n, int s){ if(n <= s || (n <= 100 && s <= 4)){ string ans = ""; for(int i = 0, bef = 0; i < n; i++){ for(int j = 0; j <= i; j++){ for(int k = 0; k < s; k++){ string candidate = ""; for(int t = 0; t < j; t++){ candidate += ans[t]; } candidate += char(97 + k); for(int t = j; t < i; t++){ candidate += ans[t]; } if(query(candidate) == bef + 1){ bef++; ans = candidate; j = i; break; } } } } if(ans.size() < n){ return string(n, 'a'); } return ans; } }

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

password.cpp: In function 'std::string guess(int, int)':
password.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...