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>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;
#include "dna.h"
/*string des = "011100101011101";
bool make_test(string s) {
F0R(i,sz(des)-sz(s)+1) if (des.substr(i,sz(s)) == s) return 1;
return 0;
}*/
string gen(int mid) {
string t; F0R(i,mid) t += '0';
return t;
}
int longest(string x) {
int lo = 0, hi = 1000;
while (lo < hi) {
int mid = (lo+hi+1)/2;
if (make_test(x.substr(0,mid))) lo = mid;
else hi = mid-1;
}
return lo;
}
int trailing(string cur) {
int ans = 0;
while (sz(cur) && cur.back() == '0') {
ans ++;
cur.pop_back();
}
return ans;
}
string analyse(int n, int t) {
int x = longest(gen(n));
string cur = gen(x);
while (1) {
if (make_test(cur+"1")) cur += "1";
else cur += "0";
if (trailing(cur) > x) {
x = longest(cur);
cur = cur.substr(0,x);
break;
}
}
while (sz(cur) < n) {
if (make_test("1"+cur)) cur = "1"+cur;
else cur = "0"+cur;
}
return cur;
}
Compilation message (stderr)
grader.cpp: In function 'bool make_test(std::__cxx11::string)':
grader.cpp:14:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < p.size(); i++) {
~~^~~~~~~~~~
grader.cpp:23:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 1; i <= ss.size(); i++) {
~~^~~~~~~~~~~~
grader.cpp:28:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (pr[i] == p.size()) {
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |