제출 #1117356

#제출 시각아이디문제언어결과실행 시간메모리
1117356CiprianPassword (RMI18_password)C++14
0 / 100
1 ms336 KiB
#include <bits/stdc++.h> using namespace std; int query(string s); string guess(int n, int s){ char a='a'; vector<char>c; map<char, int>cnt; for(int j=1; j<=s; j++){ cnt[a]=query(string(n, a)); if (cnt[s]) c.push_back(a); a++; } string w=""; for(int i=1; i<=n; i++){ int r=0; while(!cnt[c[r]] ){ r++; }char x=c[r]; for(int j=r+1; j<c.size(); j++){ if (!cnt[c[j]]) continue; if(query(w+c[j]+string(cnt[x], x))==w.size()+cnt[x]+1){ x=c[j]; } }w+=x; cnt[x]--; } return w; }

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

password.cpp: In function 'std::string guess(int, int)':
password.cpp:23:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         for(int j=r+1; j<c.size(); j++){
      |                        ~^~~~~~~~~
password.cpp:25:47: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             if(query(w+c[j]+string(cnt[x], x))==w.size()+cnt[x]+1){
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
#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...