제출 #625161

#제출 시각아이디문제언어결과실행 시간메모리
625161Mr_Husanboy콤보 (IOI18_combo)C++14
5 / 100
231 ms220 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

string guess_sequence(int N) {
    string p = "";
    string let = "ABXY";
    map<char,int> used;
    int n = N;
    int last = 0;
    while(p.size() < n){
        random_shuffle(let.begin(), let.end());
        for(auto u : let){
            if(used[u]) continue;
            while(p.size() < n) p.push_back(u);
            int k = press(p);
           // cout << p << ' ' << k << ' ' << last << endl;
            if(k == n) break;
            if(k > last){
                used[u] = 1;

            }
            while(p.size() > k) p.pop_back();
            last = p.size();

        }

    }
  //  cout << p << endl;
    return p;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   12 |     while(p.size() < n){
      |           ~~~~~~~~~^~~
combo.cpp:16:28: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |             while(p.size() < n) p.push_back(u);
      |                   ~~~~~~~~~^~~
combo.cpp:24:28: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |             while(p.size() > k) p.pop_back();
      |                   ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...