Submission #77191

# Submission time Handle Problem Language Result Execution time Memory
77191 2018-09-23T21:43:15 Z toreto_back Combo (IOI18_combo) C++14
0 / 100
2 ms 200 KB
#include "combo.h"
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef double D;
const ll mod=1e9+7;
const ll inf=(1ll<<61);
const int MX=3e5+9;

string guess_sequence(int n){
    if(n==1){
        if(press("A"))return "A";
        if(press("B"))return "B";
        if(press("X"))return "X";
        return "Y";
    }
    string p="";
    string ans="";
    if(press("AB")){
        if(press("ABAXAYBB")==1)ans+='B';
        else ans+='A';
    }
    else{
        if(press("XAXBXYYY")==1)ans+='Y';
        else ans+='X';
    }
    if(ans=="A")p="BXY";
    if(ans=="B")p="AXY";
    if(ans=="X")p="ABY";
    if(ans=="Y")p="AXB";
    while(ans.size()<n-1){
        int x=press(ans+p[0]+p[0]+ans+p[0]+p[1]+ans+p[0]+p[2]+ans+p[1]);
        if(x==ans.size()+1){
            ans+=p[1];
        }
        else if(x==ans.size())ans+=p[2];
        else ans+=p[0];
    }
    if(press(ans+p[0])==n)return ans+p[0];
    if(press(ans+p[1])==n)return ans+p[1];
    return ans+p[2];
}

Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:33:21: 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(ans.size()<n-1){
      |           ~~~~~~~~~~^~~~
combo.cpp:35:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         if(x==ans.size()+1){
      |            ~^~~~~~~~~~~~~~
combo.cpp:38:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         else if(x==ans.size())ans+=p[2];
      |                 ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
3 Correct 2 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 200 KB Output is correct
6 Correct 2 ms 200 KB Output is correct
7 Correct 1 ms 200 KB Output is correct
8 Correct 1 ms 200 KB Output is correct
9 Correct 1 ms 200 KB Output is correct
10 Incorrect 2 ms 200 KB Wrong Answer: wrong guess.
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 200 KB Output is correct
6 Correct 1 ms 200 KB Output is correct
7 Correct 1 ms 200 KB Output is correct
8 Incorrect 1 ms 200 KB Wrong Answer: wrong guess.
9 Halted 0 ms 0 KB -