Submission #385552

#TimeUsernameProblemLanguageResultExecution timeMemory
385552ismoilovCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h"
#include<bits/stdc++.h>

std::string guess_sequence(int N) {
  int n = N;
	string s, c = "ABXY";
	fp(i,0,4)
	{
		fp(j,0,n)
			s += c[i];
		int x = press(s);
		if(x > 0)
			break;
		s = "";
	}
	c.erase((c.find(s[0])), 1);
	int f = 1, i = 1, j = 0;
	while(f != n)
	{
		fp(k,i,n)
			s[k] = c[j];
		int x = press(s);
		if(x == f)
			j ++, j %= 3;
		else
		{
			i += x - f, f = x, j = (j + 1)%3;
		}
	}
	return s;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:2: error: 'string' was not declared in this scope; did you mean 'std::string'?
    6 |  string s, c = "ABXY";
      |  ^~~~~~
      |  std::string
In file included from /usr/include/c++/10/string:39,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stringfwd.h:79:33: note: 'std::string' declared here
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
combo.cpp:7:5: error: 'i' was not declared in this scope
    7 |  fp(i,0,4)
      |     ^
combo.cpp:7:2: error: 'fp' was not declared in this scope
    7 |  fp(i,0,4)
      |  ^~
combo.cpp:16:2: error: 'c' was not declared in this scope
   16 |  c.erase((c.find(s[0])), 1);
      |  ^
combo.cpp:16:18: error: 's' was not declared in this scope
   16 |  c.erase((c.find(s[0])), 1);
      |                  ^
combo.cpp:20:6: error: 'k' was not declared in this scope
   20 |   fp(k,i,n)
      |      ^