제출 #1350595

#제출 시각아이디문제언어결과실행 시간메모리
1350595bozhoCombo (IOI18_combo)C++20
30 / 100
5 ms412 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;

string guess_sequence(int n)
{
    char c[4] = {'B', 'X', 'A', 'Y'};
    vector<int>id = {0, 1, 2, 3};
    int f, l;
    string idk = "";
    for (int i = 0; i < 4; i++)
    {
        idk = "";
        idk += c[i];
        if (press(idk))
        {
            f = i;
            break;
        }
    }
    l = f;
    string s = "", tr = "";
    s += c[f];
    for (int i = 0; i < n; i++)
        tr += 'A';
    tr[0] = c[f];
    int op;
    srand(time(nullptr));
    while (s.size() < n)
    {
        random_shuffle(id.begin(),id.end());
        for (auto j:id)
        {
            if (j == l || j == f)
                continue;
            for (int i = s.size(); i < n; i++)
                tr[i] = c[j];
            l = j;
            op = press(tr);
            for (int i = s.size(); i < op; i++)
                s += c[l];
            if (op > s.size())
                break;
        }
    }
    return s;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:23: warning: 'void std::random_shuffle(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]' is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
   31 |         random_shuffle(id.begin(),id.end());
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from combo.cpp:1:
/usr/include/c++/13/bits/stl_algo.h:4581:5: note: declared here
 4581 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...