Submission #218137

# Submission time Handle Problem Language Result Execution time Memory
218137 2020-04-01T10:11:13 Z 2fat2code Password (RMI18_password) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define all(a) (a).begin(), (a).end()
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz() size()
#define fr first
#define sc second
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
#define mp make_pair
//#define int long long
#define rc(s) return cout<<s,0
#define rcc(s) cout<<s,exit(0)
using namespace std;

const int mod=1e9+7;
const int modp=1999999973;
const int modulo=998244353;

int cnt[26];
queue<string>q;

int query(string str);

string guess(int n,int s){
    ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    srand(chrono::steady_clock::now().time_since_epoch().count());
    for(int i=0;i<s;i++){
        string tz;
        for(int j=1;j<=n;j++) tz.push_back(i+'a');
        cnt[i] = query(tz);
    }
    for(int i=0;i<s;i++){
        string tz;
        for(int j=1;j<=cnt[i];j++) tz.push_back(i+'a');
        q.push(tz);
    }
    while(q.size()>=2){
        string t1=q.front();
        q.pop();
        string t2=q.front();
        string t3="";
        int i=0;
        for(int j=0;j<=tz2.size();j++){
            string t4 = tz2.substr(0,j) + t1[i] + tz2.substr(j,tz2.size()-j);
            if(query(t4)==tz2.size()+1){
                t3.push_back(t1[i]);
                i++;
                if(i==t1.size()) break;
                j--;
            }
            else t3.push_back(tz[j]);
        }
        q.push(t2);
    }
    return q.front();
}

Compilation message

password.cpp: In function 'std::__cxx11::string guess(int, int)':
password.cpp:47:24: error: 'tz2' was not declared in this scope
         for(int j=0;j<=tz2.size();j++){
                        ^~~
password.cpp:47:24: note: suggested alternative: 't2'
         for(int j=0;j<=tz2.size();j++){
                        ^~~
                        t2
password.cpp:52:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if(i==t1.size()) break;
                    ~^~~~~~~~~~~
password.cpp:55:31: error: 'tz' was not declared in this scope
             else t3.push_back(tz[j]);
                               ^~
password.cpp:55:31: note: suggested alternative: 't4'
             else t3.push_back(tz[j]);
                               ^~
                               t4