Submission #707552

#TimeUsernameProblemLanguageResultExecution timeMemory
707552firewaterCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include "combo.h"
#define ll long long
using namespace std;
string str,p;
char a[10];
int x,w;
int main()
{
	if(x=1){
		
	}
}
std::string guess_sequence(int N) {
  if(press("AB")){
  	if(press("A"))str="A";
  	else str="B";
  }
  else{
  	if(press("X"))str="X";
  	else str="Y";
  }
  if(str[0]!='A')a[++w]='A';
  if(str[0]!='B')a[++w]='B';
  if(str[0]!='X')a[++w]='X';
  if(str[0]!='Y')a[++w]='Y';
  for(int i=2;i<N;++i){
  	p=str+a[1]+a[1]+str+a[1]+a[2]+str+a[1]+a[3]+str+a[2];
  	x=press(p);
  	if(x==str.size()+2)str+=a[1];
  	else if(x==str.size()+1)str+=a[2];
  	else str+=a[3];
  }
  if(press(str+a[1])==N)str+=a[1];
  else if(press(str+a[2])==N)str+=a[2];
  else str+=a[3];
  return str;
}

Compilation message (stderr)

combo.cpp: In function 'int main()':
combo.cpp:13:6: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   13 |  if(x=1){
      |     ~^~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:33:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |    if(x==str.size()+2)str+=a[1];
      |       ~^~~~~~~~~~~~~~
combo.cpp:34:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |    else if(x==str.size()+1)str+=a[2];
      |            ~^~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cciaT3kz.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccnHUNjy.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status