제출 #496307

#제출 시각아이디문제언어결과실행 시간메모리
496307triplem5dsPassword (RMI18_password)C++14
30 / 100
502 ms536 KiB
/// Zengy MANGA
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")

#include "bits/stdc++.h"

using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i, a, b)  for(int i = a; i < b; i++)
#define all(a)  a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define mp(x,y) make_pair(x,y)
#define popCnt(x) (__builtin_popcountll(x))

using ll = long long;
using ii = pair<int,int>;
using ull = unsigned long long;
using db = long double;

const int N = 2e5+5, LG = 18, MOD = 998244353;
const long double PI = acos(-1);

int query(string s);

string guess(int n, int s) {
    string lft = "";
    string rt = "";
    while(rt.size() + lft.size() != n) {
        char cIndex = 'z' + 1;
//        cout << rt << ' ' << lft << endl;
        for(char c = 'a'; c < 'a' + s; c++) {
            if(query(rt+string(1,c) + lft) > lft.size() + rt.size()) {
                cIndex = c;
                break;
            }
        }
        if(cIndex == 'z' + 1) {
            rt.pb(lft[0]);
            lft.erase(lft.begin());
        }   else {
            lft = string(1, cIndex) + lft;
        }
    }
    return rt+lft;
}

컴파일 시 표준 에러 (stderr) 메시지

password.cpp: In function 'std::string guess(int, int)':
password.cpp:33:34: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |     while(rt.size() + lft.size() != n) {
      |           ~~~~~~~~~~~~~~~~~~~~~~~^~~~
password.cpp:37:44: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             if(query(rt+string(1,c) + lft) > lft.size() + rt.size()) {
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...