제출 #634894

#제출 시각아이디문제언어결과실행 시간메모리
634894danikoynovPassword (RMI18_password)C++14
0 / 100
0 ms336 KiB
#include<bits/stdc++.h> using namespace std; const int maxs = 26; int N, S, used[maxs]; int query(string s); string guess(int n, int s) { N = n; S = s; string ans = ""; for (int i = 0; i < n; i ++) ans = ans + 'a'; return ans; for (int i = 0; i < s; i ++) { string cur = ""; for (int j = 0; j < n; j ++) cur = cur + (char)(i + 'a'); if (query(cur) == 1) ans = ans + (char)(i + 'a'), used[i] = 1; } int len = query(ans); for (int j = 0; j < s; j ++) { if (!used[j]) continue; int id = 0; string wt = ""; for (int i = 0; i < n; i ++) { if (ans[i] != (char)(j + 'a')) wt = wt + ans[i]; } for (int i = 0; i < n; i ++) { string cur = wt; cur.insert(cur.begin() + i, (char)(j + 'a')); int sm = query(cur); if (sm > len) { len = sm; ans = cur; } } } return ans; }

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

password.cpp: In function 'std::string guess(int, int)':
password.cpp:31:13: warning: unused variable 'id' [-Wunused-variable]
   31 |         int id = 0;
      |             ^~
#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...