Submission #77351

# Submission time Handle Problem Language Result Execution time Memory
77351 2018-09-26T03:27:28 Z Just_Solve_The_Problem Combo (IOI18_combo) C++11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.cpp"
#include "combo.h"

#define pb push_back
#define sz(s) (int)s.size()

using namespace std;

char c[] = {'A', 'B', 'X', 'Y'};

int ask(string s) {
	return press(s);
}

string guess_sequence(int N) {
  string ans;   
  if (ask("AB")) 
  	if (ask("A")) 
  		ans.pb('A');
  	else 
  		ans.pb('B');
  else 
  	if (ask("X"))
  		ans.pb('X');
  	else
  		ans.pb('Y');
  vector < char > vec;
  for (int i = 0; i < 4; i++) {
  	if (c[i] == ans[0]) 
  		continue;
  	vec.pb(c[i]);
  }
  for (int i = 1; i < N - 1; i++) {  	
  	int temp = ask(ans + vec[0] + vec[0] + ans + vec[0] + vec[1] + ans + vec[0] + vec[2] + ans + vec[1]);
  	if (temp == sz(ans)) {
  		ans.pb(vec[2]);
  	} else if (temp == sz(ans) + 1) {
  		ans.pb(vec[1]);
  	} else {
  		ans.pb(vec[0]);
  	}
  }
  if (N == 1) return ans;	
  if (ask(ans + vec[0]) == N) 
  	ans.pb(vec[0]);
  else if (ask(ans + vec[1]) == N) 
  	ans.pb(vec[1]);
  else
  	ans.pb(vec[2]);
  return ans;	  
}

Compilation message

/usr/bin/ld: /tmp/ccWG0f2l.o: in function `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/ccB8dMpk.o:combo.cpp:(.text+0xc0): first defined here
/usr/bin/ld: /tmp/ccWG0f2l.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccB8dMpk.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status