답안 #899819

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
899819 2024-01-07T05:57:18 Z Cookie Password (RMI18_password) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include<fstream>
using namespace std;
#define sz(a) (int)a.size()
#define ALL(v) v.begin(), v.end()
#define ALLR(v) v.rbegin(), v.rend()
#define ll long long
#define pb push_back
#define forr(i, a, b) for(int i = a; i < b; i++)
#define dorr(i, a, b) for(int i = a; i >= b; i--)
#define ld long double
#define vt vector
#include<fstream>
#define fi first
#define se second
#define pll pair<ll, ll>
#define pii pair<int, int>
#define mpp make_pair
int query();
bool cmp(string a, string b){
    return(sz(a) > sz(b));
}
vt<string>v;
string guess(int n, int s){
    for(int i = 0; i < s; i++){
        string s = "";
        while(1){
            s += (i + 'a');
            if(query(s) != sz(s)){
                s.pop_back(); break;
            }
        }
        if(s != "")v.pb(s);
    }
    //for(auto i: v)cout << i << " ";
    while(sz(v) > 1){
        sort(ALL(v), cmp);
        string s1 = v.back(), s2 = v[sz(v) - 2];
        int l1 = 0, l2 = 0;
        string s3 = "";
        while(l1 < sz(s1) || l2 < sz(s2)){
            if(l1 == sz(s1))s3 += s2[l2++];
            else if(l2 == sz(s2))s3 += s1[l1++];
            else{
                string s4 = s3 + s1[l1];
                for(int i = l2; i < sz(s2); i++)s4 += s2[i];

                if(query(s4) == sz(s4)){
                    s3 += s1[l1++];
                }else{
                    s3 += s2[l2++];
                }
            }
        }

        v.pop_back(); v.pop_back(); v.pb(s3);
    }
    return(v[0]);
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:29:23: error: too many arguments to function 'int query()'
   29 |             if(query(s) != sz(s)){
      |                       ^
password.cpp:19:5: note: declared here
   19 | int query();
      |     ^~~~~
password.cpp:48:28: error: too many arguments to function 'int query()'
   48 |                 if(query(s4) == sz(s4)){
      |                            ^
password.cpp:19:5: note: declared here
   19 | int query();
      |     ^~~~~