AtCoder Regular Contest 070 and interactive problems

Правка en1, от rng_58, 2017-03-15 14:51:23

There will be ARC 070 this Saturday, and interactive problems may be used there.

You can try an example of interactive problem on AtCoder here: https://practice.contest.atcoder.jp/tasks/practice_2

Here is my solution for 100 points:

#include <fstream>
#include <string>

using namespace std;

int main(void){
	int N,Q,i,j;
	
	scanf("%d%d", &N, &Q);
	
	string s;
	for(i=0;i<N;i++) s += (char)('A' + i);
	
	for(i=0;i<N;i++) for(j=0;j<N-1;j++){
		printf("? %c %c\n", s[j], s[j+1]);
		fflush(stdout);
		char ans;
		scanf(" %c", &ans);
		if(ans == '>') swap(s[j], s[j+1]);
	}
	
	printf("! %s\n", s.c_str());
	fflush(stdout);
	
	return 0;
}
Теги atcoder, interactive, interactive problem

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский rng_58 2017-03-15 14:51:23 777 Initial revision (published)