답안 #331942

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
331942 2020-11-30T18:50:11 Z a_player Password (RMI18_password) C++17
0 / 100
1 ms 492 KB
#include <bits/stdc++.h>
#ifdef ALE
#include "grader.cpp"
#endif

using namespace std;

int query(string str);

bool v[50];
string guess(int n, int s){
  string t="";
  string sol="";
    for(int q=0;q<n;q++){
      for(int k=0;k<s;k++)v[k]=0;
      bool found=false;
      char possible='a';
      v[0]=1;
      while(!found){
        t=sol;
        for(int i=0;i<n-sol.size();i++)t+=possible;
        int l=query(t);
        assert(false);
        bool prev=false;
        for(int i=0;i<s;i++){
          if(v[i])continue;
          v[i]=true;
          t[sol.size()]='a'+i;
          if(query(t)>l){
            possible='a'+i;
            prev=true;
            i=s;
          }
        }
        if(!prev){
          sol+=possible;
          found=true;
        }
      }

    }
    return sol;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:21:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         for(int i=0;i<n-sol.size();i++)t+=possible;
      |                     ~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -