#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
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()) {
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
428 KB |
Output is correct |
4 |
Correct |
2 ms |
428 KB |
Output is correct |
5 |
Correct |
2 ms |
480 KB |
Output is correct |
6 |
Correct |
2 ms |
540 KB |
Output is correct |
7 |
Correct |
2 ms |
540 KB |
Output is correct |
8 |
Correct |
2 ms |
540 KB |
Output is correct |
9 |
Correct |
2 ms |
540 KB |
Output is correct |
10 |
Correct |
2 ms |
556 KB |
Output is correct |
11 |
Correct |
2 ms |
604 KB |
Output is correct |
12 |
Correct |
2 ms |
604 KB |
Output is correct |
13 |
Correct |
2 ms |
604 KB |
Output is correct |
14 |
Correct |
2 ms |
604 KB |
Output is correct |
15 |
Correct |
2 ms |
604 KB |
Output is correct |
16 |
Correct |
2 ms |
604 KB |
Output is correct |
17 |
Correct |
2 ms |
604 KB |
Output is correct |
18 |
Correct |
2 ms |
604 KB |
Output is correct |
19 |
Correct |
2 ms |
604 KB |
Output is correct |
20 |
Correct |
2 ms |
604 KB |
Output is correct |
21 |
Correct |
2 ms |
604 KB |
Output is correct |
22 |
Correct |
2 ms |
604 KB |
Output is correct |
23 |
Correct |
2 ms |
604 KB |
Output is correct |
24 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
2 ms |
604 KB |
Output is correct |
6 |
Correct |
2 ms |
620 KB |
Output is correct |
7 |
Correct |
2 ms |
620 KB |
Output is correct |
8 |
Correct |
2 ms |
620 KB |
Output is correct |
9 |
Correct |
2 ms |
644 KB |
Output is correct |
10 |
Correct |
2 ms |
644 KB |
Output is correct |
11 |
Correct |
2 ms |
644 KB |
Output is correct |
12 |
Correct |
2 ms |
644 KB |
Output is correct |
13 |
Correct |
2 ms |
644 KB |
Output is correct |
14 |
Correct |
2 ms |
644 KB |
Output is correct |
15 |
Correct |
2 ms |
644 KB |
Output is correct |
16 |
Correct |
2 ms |
644 KB |
Output is correct |
17 |
Correct |
2 ms |
644 KB |
Output is correct |
18 |
Correct |
2 ms |
644 KB |
Output is correct |
19 |
Correct |
2 ms |
644 KB |
Output is correct |
20 |
Correct |
2 ms |
644 KB |
Output is correct |
21 |
Correct |
2 ms |
644 KB |
Output is correct |
22 |
Correct |
2 ms |
644 KB |
Output is correct |
23 |
Correct |
2 ms |
644 KB |
Output is correct |
24 |
Correct |
2 ms |
644 KB |
Output is correct |
25 |
Correct |
2 ms |
644 KB |
Output is correct |
26 |
Correct |
2 ms |
644 KB |
Output is correct |
27 |
Correct |
2 ms |
644 KB |
Output is correct |
28 |
Correct |
2 ms |
644 KB |
Output is correct |
29 |
Correct |
2 ms |
644 KB |
Output is correct |
30 |
Correct |
2 ms |
644 KB |
Output is correct |
31 |
Correct |
2 ms |
644 KB |
Output is correct |
32 |
Correct |
2 ms |
644 KB |
Output is correct |
33 |
Correct |
2 ms |
644 KB |
Output is correct |
34 |
Correct |
2 ms |
644 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
644 KB |
Output is correct |
2 |
Correct |
2 ms |
644 KB |
Output is correct |
3 |
Correct |
2 ms |
644 KB |
Output is correct |
4 |
Correct |
2 ms |
644 KB |
Output is correct |
5 |
Correct |
2 ms |
644 KB |
Output is correct |
6 |
Correct |
2 ms |
644 KB |
Output is correct |
7 |
Correct |
2 ms |
644 KB |
Output is correct |
8 |
Correct |
2 ms |
644 KB |
Output is correct |
9 |
Correct |
2 ms |
644 KB |
Output is correct |
10 |
Correct |
1 ms |
644 KB |
Output is correct |
11 |
Correct |
2 ms |
644 KB |
Output is correct |
12 |
Correct |
2 ms |
644 KB |
Output is correct |
13 |
Correct |
2 ms |
644 KB |
Output is correct |
14 |
Correct |
2 ms |
644 KB |
Output is correct |
15 |
Correct |
3 ms |
644 KB |
Output is correct |
16 |
Correct |
2 ms |
644 KB |
Output is correct |
17 |
Correct |
3 ms |
644 KB |
Output is correct |
18 |
Correct |
2 ms |
644 KB |
Output is correct |
19 |
Correct |
2 ms |
644 KB |
Output is correct |
20 |
Correct |
3 ms |
644 KB |
Output is correct |
21 |
Correct |
3 ms |
644 KB |
Output is correct |
22 |
Correct |
11 ms |
644 KB |
Output is correct |
23 |
Correct |
16 ms |
644 KB |
Output is correct |
24 |
Correct |
14 ms |
644 KB |
Output is correct |
25 |
Correct |
19 ms |
644 KB |
Output is correct |
26 |
Correct |
18 ms |
644 KB |
Output is correct |
27 |
Correct |
10 ms |
760 KB |
Output is correct |
28 |
Correct |
11 ms |
760 KB |
Output is correct |
29 |
Correct |
3 ms |
760 KB |
Output is correct |
30 |
Correct |
11 ms |
760 KB |
Output is correct |
31 |
Correct |
12 ms |
760 KB |
Output is correct |
32 |
Correct |
2 ms |
760 KB |
Output is correct |
33 |
Correct |
13 ms |
760 KB |
Output is correct |
34 |
Correct |
14 ms |
760 KB |
Output is correct |
35 |
Correct |
14 ms |
760 KB |
Output is correct |
36 |
Correct |
14 ms |
760 KB |
Output is correct |
37 |
Correct |
13 ms |
760 KB |
Output is correct |
38 |
Correct |
16 ms |
760 KB |
Output is correct |
39 |
Correct |
9 ms |
760 KB |
Output is correct |