제출 #373582

#제출 시각아이디문제언어결과실행 시간메모리
373582teehandsome콤보 (IOI18_combo)C++11
30 / 100
57 ms560 KiB
#include "combo.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define endl '\n'
#define INF 1e9+7
#define all(x) x.begin(),x.end()

using namespace std;
using namespace __gnu_pbds;
using pii=pair<int,int>;
using ppi=pair<int,pii>;
using ll=long long;
using oset=tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>;

void _print(vector<pii> x) {cerr<<"["; for(auto e:x) cerr<<"{"<<e.first<<","<<e.second<<"} ,"; cerr<<"]";}
template<typename T>
void _print(vector<T> x) {cerr<<"{"; for(auto e:x) cerr<<e<<","; cerr<<"}";}
void _print(pii x) {cerr<<"{"<<x.first<<","<<x.second<<"}";}
template<typename T>
void _print(T x) {cerr<<x;}
void dbg() {cerr<<endl;}
template<typename Head,typename... Tail>
void dbg(Head H,Tail... T) {
    _print(H);
    if(sizeof...(T)) cerr<<",";
    else cerr<<"]";
    dbg(T...);
}
#define debug(...) cerr<<"[\""<<#__VA_ARGS__<<"\"]: [",dbg(__VA_ARGS__);

char a[4]={'A','B','X','Y'};
vector<char> ar;

std::string guess_sequence(int N) {
    string ans;
    for(int i=0;i<3;i++) {
        string temp; temp.push_back(a[i]);
        int res=press(temp);
        if(res==1) {
           ans+=a[i]; break;
        }
    }
    if(ans.empty()) ans.push_back(a[3]);

    for(int i=0;i<4;i++) {
        if(a[i]!=ans[0]) ar.push_back(a[i]);
    }
    for(int i=1;i<N;i++) {
        for(int j=0;j<2;j++) {
            string temp=ans; temp.push_back(ar[j]);
            int res=press(temp);
            if(res==i+1) {
                ans=temp; break;
            }
        }
        if(ans.size()==i+1) continue;
        else ans.push_back(ar[2]);
    }
    return ans;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:58:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   58 |         if(ans.size()==i+1) continue;
      |            ~~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...