#include<bits/stdc++.h>
#define pb emplace_back
#define AI(i) begin(i), end(i)
using namespace std;
using ll = long long;
#ifdef KEV
#define DE(args...) kout("[ " + string(#args) + " ] : ", args)
void kout() { cerr << endl; }
template<class T, class ...U>
void kout(T a, U ...b) { cerr << a << ' ', kout(b...); }
void debug(auto L, auto R) { while (L != R) cerr << *L << " \n"[next(L) == R], ++L; }
vector<int> ans{0,1,1,1,0,1,1,0,1,1,0};
bool isSubsequence(vector<int> a) {
for (int i = 0, j = 0;i < a.size();++i) {
while (j < ans.size() && ans[j] != a[i])
++j;
if (j == ans.size()) return false;
++j;
}
return true;
}
#else
#include "grader.h"
#define debug(...) 0
#define DE(...) 0
#endif
const int MAX_N = 300010;
const vector<int> zero{0}, one{1};
int n;
bool query(vector<int> a) {
if (a.size() > n) return false;
return isSubsequence(a);
}
vector<int> operator + (vector<int> a, vector<int> b) {
a.insert(end(a), AI(b));
return a;
}
vector<int> findSequence(int _n) {
n = _n;
vector<int> res;
while (res.size() < n) {
vector<int> F, B = res;
for (int i = 0;i <= res.size();++i) {
while (query( F + zero + B))
F.pb(0);
while (query( F + one + B))
F.pb(1);
F.pb(B[0]);
B.erase(begin(B));
}
}
return res;
}
#ifdef KEV
int32_t main() {
ios_base::sync_with_stdio(0), cin.tie(0);
vector<int> res = findSequence(ans.size());
if (res == ans)
cerr << "AC!\n";
else {
cerr << "WA\n";
debug(AI(res));
cerr << "Should be\n";
debug(AI(ans));
}
}
#endif
Compilation message
hidden.cpp: In function 'bool query(std::vector<int>)':
hidden.cpp:31:15: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
31 | if (a.size() > n) return false;
| ~~~~~~~~~^~~
hidden.cpp: In function 'std::vector<int> findSequence(int)':
hidden.cpp:42:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
42 | while (res.size() < n) {
| ~~~~~~~~~~~^~~
hidden.cpp:44:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | for (int i = 0;i <= res.size();++i) {
| ~~^~~~~~~~~~~~~
grader.cpp: In function 'int main()':
grader.cpp:28:26: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
28 | fprintf (fifo_out, "%d\n", ans.size ());
| ~^ ~~~~~~~~~~~
| | |
| int std::vector<int>::size_type {aka long unsigned int}
| %ld
grader.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
29 | for (int i=0; i<ans.size () && i < N; i++)
| ~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |