답안 #918568

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918568 2024-01-30T06:53:36 Z Elvin_Fritl Password (RMI18_password) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
 
const int N=2e3+5, mod=1e9+7;

mt19937 rng(time(NULL));

string guess(int n, int s) {
    vector<int> v(s);
    for(int i=0;i<s;i++) {
        v[i] = i;
    }
    shuffle(v.begin() , v.end() , rng);
    string res;
    for(int i=0;i<n;i++) {
        for(int j=0;j<s;j++) {
            int tmp = query(to_string(res + s[j]));
            if(tmp == i + 1) {
                res += s[j];
                break;
            }
        }
    }
    return res;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:19:46: error: invalid types 'int[int]' for array subscript
   19 |             int tmp = query(to_string(res + s[j]));
      |                                              ^
password.cpp:19:23: error: 'query' was not declared in this scope
   19 |             int tmp = query(to_string(res + s[j]));
      |                       ^~~~~
password.cpp:21:25: error: invalid types 'int[int]' for array subscript
   21 |                 res += s[j];
      |                         ^