Submission #956278

# Submission time Handle Problem Language Result Execution time Memory
956278 2024-04-01T13:35:12 Z mostafa133 Combo (IOI18_combo) C++14
5 / 100
1 ms 596 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "combo.h"
typedef long long ll;
typedef long double ld;
using namespace std;
using namespace __gnu_pbds;
using ordered_set = tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;
#define all(x) x.begin(), x.end()
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
const ll mod = 998244353;
std::string guess_sequence(int N)
{
    string x = "ABXY", y;
    char z;
    string ans;
    ll b = press("A");
    if (b)
    {
        ans.push_back('A');
        y = "BXBXXXY";
        z = 'Y';
    }
    else if (press("B"))
    {
        ans.push_back('B');
        y = "AXAXYXX";
        z = 'Y';
    }
    else if (press("X"))
    {
        ans.push_back('X');
        y = "ABABYBB";
        z = 'Y';
    }
    else
    {
        ans.push_back('Y');
        y = "ABABXBB";
        z = 'X';
    }
    // cout << ans << ' ';
    for (int i = 1; i < N-1; i++)
    {
        ll m = ans.size();
        b = press(ans + y.substr(0, 1) + ans + y.substr(1, 2) + ans + y.substr(3, 2) + ans + y.substr(5, 2));
        if (b == m + 1)
        {
            ans.push_back(y[0]);
        }
        else if (b == m + 2)
        {
            ans.push_back(y[1]);
        }
        else
        {
            ans.push_back(z);
        }
    }
    if(press(ans+'A'+ans+'B')!=ans.size())
    {
        if(press(ans+'A') !=ans.size())
        {
            ans.push_back('A');
        }
        else
        {
            ans.push_back('B');
        }
    }
    else
    {
        if(press(ans+'X') !=ans.size())
        {
            ans.push_back('X');
        }
        else
        {
            ans.push_back('Y');
        }
    }
    // cout << ans<<' ';
    return ans;
}

Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:61:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |     if(press(ans+'A'+ans+'B')!=ans.size())
      |        ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:63:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |         if(press(ans+'A') !=ans.size())
      |            ~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:74:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 |         if(press(ans+'X') !=ans.size())
      |            ~~~~~~~~~~~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 596 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 500 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 0 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 344 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 0 ms 344 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 0 ms 344 KB Output is correct
36 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong Answer: wrong guess.
2 Halted 0 ms 0 KB -