Submission #261766

#TimeUsernameProblemLanguageResultExecution timeMemory
261766yabsed콤보 (IOI18_combo)C++17
0 / 100
1 ms200 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

string guess_sequence(int N) {
    char crr[]={'A', 'B', 'X', 'Y'};
    char wow[N+5];
    vector <char> cr;
    string S;
    for(int i=0;i<N;i++){
        //crr[i]=-1;
        if(!i){
            wow[0]='A';
            for(int j=1;j<=3;j++){
                string p="";
                p+=crr[j];
                //printf("!%s\n", p);
                int coins=press(p);
                if(coins)wow[0]=crr[j];
            }
            //printf("%c", wow[0]);
            for(int j=0;j<4;j++){
                //printf("\n%d %d\n", wow[0], crr[j]);
                if(wow[0]!=crr[j])
                    cr.push_back(crr[j]);
            }
        }
        else{
            //printf("%d\n", cr.size());
            wow[i]=cr[0];
            for(int j=1;j<cr.size();j++){
                string p=S;
                //std::cout << S << std::endl;
                p+=cr[j];
                //std::cout << p << std::endl;
                //pri
                //printf("%s\n", p);
                int coins=press(p);
                if(coins==i+1){
                    wow[i]=cr[j];
                }
            }
        }
        //printf("??%c\n", wow[i]);
        S+=wow[i];
        std::cout << S << std::endl;



    }
    return S;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             for(int j=1;j<cr.size();j++){
      |                         ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...