제출 #470005

#제출 시각아이디문제언어결과실행 시간메모리
470005AdamGS콤보 (IOI18_combo)C++14
5 / 100
1 ms200 KiB
#include "combo.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
string guess_sequence(int n) {
	string c[]={"A", "B", "X", "Y"};
	if(!press(c[0]+c[1])) {
		swap(c[0], c[2]);
		swap(c[1], c[3]);
	}
	if(!press(c[0])) swap(c[0], c[1]);
	string ans=c[0];
	for(int i=1; i<n-1; ++i) {	
		int x=press(ans+c[1]+ans+c[2]+c[1]+ans+c[2]+c[2]+ans+c[2]+c[3]);
		if(x==ans.size()) {
			ans+=c[3];
		} else if(x==ans.size()+1) {
			ans+=c[1];
		} else {
			ans+=c[2];
		}
	}
	if(press(ans+c[1])==n) {
		ans+=c[1];
	} else if(press(ans+c[2])==n) {
		ans+=c[2];
	} else {
		ans+=c[3];
	}
	return ans;
}

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

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