This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits//stdc++.h>
using namespace std;
#define ll int
#define iloop(m, h) for (ll i = m; i != h; i += (m < h ? 1 : -1))
#define jloop(m, h) for (auto j = m; j != h; j += (m < h ? 1 : -1))
#define kloop(m, h) for (auto k = m; k != h; k += (m < h ? 1 : -1))
#define INF (ll)2e15
#define MOD2 998244353
#define pll pair<ll, ll>
#include "grader.h"
vector<int> findSequence (int N){
vector<ll> v;
ll lb = 0, ub = N, mid;
while (lb < ub) {
mid = (lb + ub + 1) >> 1;
vector<ll> test;
iloop(0, mid) test.push_back(0);
if (isSubsequence(test)) lb = mid;
else ub = mid - 1;
}
mid = lb;
ll ccnt = mid;
ll ans[mid+1];
vector<ll> cv;
iloop(0, mid) cv.push_back(0);
iloop(0, mid + 1) {
ll ctot = 0;
while (1) {
cv.push_back(1);
jloop(i, 0) cv.push_back(0);
if (cv.size() > N || !isSubsequence(cv)) {
jloop(i, 0) cv.pop_back();
jloop(0, ctot+1) cv.pop_back();
break;
}
jloop(i, 0) cv.pop_back();
ctot++;
ccnt++;
}
ans[i] = ctot;
cv.pop_back();
}
vector<ll> an;
iloop(mid, -1) {
jloop(0, ans[i]) an.push_back(1);
an.push_back(0);
}
an.pop_back();
return an;
}
Compilation message (stderr)
hidden.cpp: In function 'std::vector<int> findSequence(int)':
hidden.cpp:33:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
33 | if (cv.size() > N || !isSubsequence(cv)) {
| ~~~~~~~~~~^~~
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |