#include "grader.h"
#define wiwihorz
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma loop-opt(on)
#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define all(x) x.begin(), x.end()
#define ceil(a, b) ((a + b - 1) / (b))
using namespace std;
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())
#ifdef wiwihorz
#define print(a...) cerr << "Line " << __LINE__ << ": ", kout("[" + string(#a) + "] = ", a)
void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
void kout() { cerr << endl; }
template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...);}
#else
#define print(...) 0
#define vprint(...) 0
#endif
vector <int> findSequence (int N) {
vector<int> ans, a, b, q;
int id = 0, num = -1;
int mx1 = N / 2 + 1, mx2 = (N * 3) / 4 + 1;
// get num
rep(i, 1, mx1) {
q.push_back(0);
if(!isSubsequence(q)) {
num = i - 1;
break;
}
}
if(num == -1) {
id = 1, q.clear();
rep(i, 1, mx1) {
q.push_back(1);
if(!isSubsequence(q)) {
num = i - 1;
break;
}
}
}
// get wall
rep(i, 0, num) {
q.clear();
rep(j, 1, i) q.push_back(id);
q.push_back(!id);
rep(j, 1, num - i) q.push_back(id);
if(isSubsequence(q)) a.push_back(i);
}
// get wall num
b.assign(a.size(), 0);
int sz = a.size(), tot = 0;
rep(i, 0, signed(a.size()) - 1) {
rep(j, 1, mx2 - num) {
q.clear();
rep(k, 1, a[i]) q.push_back(id);
rep(k, 1, j) q.push_back(!id);
rep(k, 1, num - a[i]) q.push_back(id);
if(!isSubsequence(q)) {
b[i] = j - 1;
tot += j - 1;
break;
}
}
}
int left = N - num - tot, cur = 0;
rep(i, 0, sz - 1) if(!b[i]) b[i] = left;
rep(i, 0, sz - 1) {
while(cur < a[i]) ans.push_back(id), cur ++;
rep(j, 1, b[i]) ans.push_back(!id);
}
while(cur < num) ans.push_back(id), cur++;
return ans;
}
Compilation message
hidden.cpp:5: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
5 | #pragma loop-opt(on)
|
hidden.cpp:19:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
19 | void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
| ^~~~
hidden.cpp:19:21: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
19 | void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
| ^~~~
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++)
| ~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
200 KB |
Output is partially correct: Maximum length of a query = 7 |
2 |
Partially correct |
1 ms |
200 KB |
Output is partially correct: Maximum length of a query = 8 |
3 |
Partially correct |
1 ms |
200 KB |
Output is partially correct: Maximum length of a query = 7 |
4 |
Partially correct |
1 ms |
200 KB |
Output is partially correct: Maximum length of a query = 7 |
5 |
Partially correct |
0 ms |
200 KB |
Output is partially correct: Maximum length of a query = 6 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
7 ms |
272 KB |
Output is partially correct: Maximum length of a query = 86 |
2 |
Partially correct |
9 ms |
200 KB |
Output is partially correct: Maximum length of a query = 92 |
3 |
Partially correct |
8 ms |
200 KB |
Output is partially correct: Maximum length of a query = 102 |
4 |
Partially correct |
7 ms |
296 KB |
Output is partially correct: Maximum length of a query = 87 |
5 |
Partially correct |
7 ms |
200 KB |
Output is partially correct: Maximum length of a query = 103 |
6 |
Partially correct |
6 ms |
296 KB |
Output is partially correct: Maximum length of a query = 130 |
7 |
Partially correct |
7 ms |
200 KB |
Output is partially correct: Maximum length of a query = 145 |
8 |
Partially correct |
6 ms |
200 KB |
Output is partially correct: Maximum length of a query = 124 |
9 |
Partially correct |
9 ms |
296 KB |
Output is partially correct: Maximum length of a query = 126 |
10 |
Partially correct |
7 ms |
200 KB |
Output is partially correct: Maximum length of a query = 125 |
11 |
Partially correct |
7 ms |
200 KB |
Output is partially correct: Maximum length of a query = 97 |
12 |
Partially correct |
8 ms |
300 KB |
Output is partially correct: Maximum length of a query = 150 |
13 |
Partially correct |
8 ms |
200 KB |
Output is partially correct: Maximum length of a query = 107 |