답안 #643114

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
643114 2022-09-21T08:42:09 Z TimDee Password (RMI18_password) C++17
10 / 100
5 ms 208 KB
#include <bits/stdc++.h>
using namespace std;

int query(string s);

string guess(int n, int c) {
  if (n<=c && c<=26) {
    string ans(n,'.');
    for (char i='a'; i<'a'+c; ++i) {
      int x=0;
      for (char j='a'; j<'a'+c; ++j) {
        if (j==i) continue;
        string s;
        s+=i; s+=j;
        int q=query(s);
        x+=q-1;
      }
      if (x<0) continue;
      ans[n-1-x]=i;
    }
    return ans;
  }
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:23:1: warning: control reaches end of non-void function [-Wreturn-type]
   23 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Guessed the password with 211 queries.
2 Correct 5 ms 208 KB Guessed the password with 507 queries.
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Token "................................................b." doesn't correspond to pattern "[a-b]{1,50}"
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Token "....................................................l...b......." doesn't correspond to pattern "[a-l]{1,1000}"
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Guessed the password with 211 queries.
2 Correct 5 ms 208 KB Guessed the password with 507 queries.
3 Incorrect 0 ms 208 KB Token "................................................b." doesn't correspond to pattern "[a-b]{1,50}"
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Guessed the password with 211 queries.
2 Correct 5 ms 208 KB Guessed the password with 507 queries.
3 Incorrect 0 ms 208 KB Token "................................................b." doesn't correspond to pattern "[a-b]{1,50}"
4 Halted 0 ms 0 KB -