Submission #548302

#TimeUsernameProblemLanguageResultExecution timeMemory
548302Killer2501Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#define fi first #define se second #define pb push_back #include "combo.h" using namespace std; using ll = long long; using ld = long double; const int N = 3e5 +2; const int base = 31; const int mod = 1e9 +7; int a[4], k; int press(string s) { cout << s << endl; cin >> k; return k; } string guess_sequence(int n) { string res; memset(a, 1, sizeof(a)); for(int i = 1; i <= n; i ++) { string s; if(a[0]) { k = press(res+"A"); if(k == i) { res += "A"; if(i == 1)a[0] = 0; continue; } } if(a[1]) { k = press(res+"B"); if(k == i) { res += "B"; if(i == 1)a[1] = 0; continue; } } if(a[2]) { k = press(res+"X"); if(k == i) res += "Y"; if(i == 1)a[3] = 0; } } return res; }

Compilation message (stderr)

combo.cpp: In function 'int press(std::string)':
combo.cpp:15:5: error: 'cout' was not declared in this scope
   15 |     cout << s << endl;
      |     ^~~~
combo.cpp:5:1: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    4 | #include "combo.h"
  +++ |+#include <iostream>
    5 | using namespace std;
combo.cpp:15:18: error: 'endl' was not declared in this scope
   15 |     cout << s << endl;
      |                  ^~~~
combo.cpp:5:1: note: 'std::endl' is defined in header '<ostream>'; did you forget to '#include <ostream>'?
    4 | #include "combo.h"
  +++ |+#include <ostream>
    5 | using namespace std;
combo.cpp:16:5: error: 'cin' was not declared in this scope
   16 |     cin >> k;
      |     ^~~
combo.cpp:16:5: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:22:5: error: 'memset' was not declared in this scope
   22 |     memset(a, 1, sizeof(a));
      |     ^~~~~~
combo.cpp:5:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    4 | #include "combo.h"
  +++ |+#include <cstring>
    5 | using namespace std;