제출 #138413

#제출 시각아이디문제언어결과실행 시간메모리
138413degelo콤보 (IOI18_combo)C++17
0 / 100
2 ms328 KiB
#include<bits/stdc++.h>
#include "combo.h"
using namespace std;
string a[4]; 
int first;
string s;
string guess_sequence(int n){
	a[0]="A",a[1]="B",a[2]="X",a[3]="Y";
	bool achou=false;
	for(int i=0;i<3;i++){
		if(!achou){
			int t=press(a[i]);
			if(t==1){
				first=i;
				s+=a[i];	
				achou=true;
			}
		}
	}	
	if(!achou){
		first=3;
		s+=a[3];
	}
	vector<string> b;
	for(int i=0;i<4;i++){
		if(i!=first) b.push_back(a[i]);
	}
	for(int i=1;i<n;i++){
		string st=s+b[0]+b[0]+s+b[0]+b[1]+s+b[0]+b[2]+s+b[1];
		int t=press(st);
		if(t==s.size()){
			s+=b[2];
		}
		if(t==s.size()+1){
			s+=b[1];
		}
		if(t==s.size()+2){
			s+=b[0];
		}
	}
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |   if(t==s.size()){
      |      ~^~~~~~~~~~
combo.cpp:34:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   if(t==s.size()+1){
      |      ~^~~~~~~~~~~~
combo.cpp:37:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   if(t==s.size()+2){
      |      ~^~~~~~~~~~~~
combo.cpp:41:1: warning: no return statement in function returning non-void [-Wreturn-type]
   41 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...