# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
242702 |
2020-06-29T04:04:37 Z |
HynDuf |
Martian DNA (IOI16_dna) |
C++14 |
|
18 ms |
512 KB |
#include <bits/stdc++.h>
#include <dna.h>
#define task "D"
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i <= (r); ++i)
#define Rep(i, r, l) for (int i = (r); i >= (l); --i)
#define DB(X) { cerr << #X << " = " << (X) << '\n'; }
#define DB1(A, _) { cerr << #A << "[" << _ << "] = " << (A[_]) << '\n'; }
#define DB2(A, _, __) { cerr << #A << "[" << _ << "][" << __ << "] = " << (A[_][__]) << '\n'; }
#define DB3(A, _, __, ___) { cerr << #A << "[" << _ << "][" << __ << "][" << ___ << "] = " << (A[_][__][___]) << '\n'; }
#define PR(A, l, r) { cerr << '\n'; rep(_, l, r) DB1(A, _); cerr << '\n';}
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back
#define pf push_front
#define F first
#define S second
#define by(x) [](const auto& a, const auto& b) { return a.x < b.x; } // sort(arr, arr + N, by(a));
#define next ___next
#define prev ___prev
#define y1 ___y1
#define left ___left
#define right ___right
#define y0 ___y0
#define div ___div
#define j0 ___j0
#define jn ___jn
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using namespace std;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vl;
/*
string S = "100110100";
bool make_test(string P)
{
return (S.find(P) != string::npos);
}
*/
string analyse(int n, int t)
{
int l = 1, r = n, len = 0;
while (l <= r)
{
int m = (l + r) >> 1;
string q = "";
rep(i, 1, m) q += '0';
if (make_test(q)) l = m + 1, len = m;
else r = m - 1;
}
string tem = "";
rep(i, 1, len) tem += '0';
int conse0 = len;
while (conse0 <= len)
{
string te = tem + '1';
if (make_test(te)) tem += '1', conse0 = 0;
else tem += '0', conse0++;
}
l = 1, r = len;
string ans = tem.substr(0, SZ(tem) - len - 1);
while (l <= r)
{
int m = (l + r) >> 1;
string te = tem.substr(0, SZ(tem) - (len + 1 - m));
if (make_test(te)) l = m + 1, ans = te;
else r = m - 1;
}
int left = n - SZ(ans);
rep(i, 1, left)
{
string te = '1' + ans;
if (make_test(te)) ans = te;
else ans = '0' + te;
}
return ans;
}
/*
int main()
{
#ifdef HynDuf
freopen(task".in", "r", stdin);
//freopen(task".out", "w", stdout);
#else
ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif
cout << analyse(SZ(S), 2 * SZ(S));
return 0;
}
*/
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()) {
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Incorrect |
5 ms |
384 KB |
Wrong DNA |
9 |
Correct |
5 ms |
256 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |
11 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
12 |
Correct |
5 ms |
256 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
256 KB |
Output is correct |
15 |
Correct |
5 ms |
256 KB |
Output is correct |
16 |
Correct |
5 ms |
256 KB |
Output is correct |
17 |
Correct |
4 ms |
256 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
5 ms |
256 KB |
Output is correct |
20 |
Correct |
5 ms |
256 KB |
Output is correct |
21 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
376 KB |
Output is correct |
24 |
Correct |
5 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
256 KB |
Output is correct |
9 |
Correct |
5 ms |
256 KB |
Output is correct |
10 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
11 |
Correct |
5 ms |
256 KB |
Output is correct |
12 |
Correct |
5 ms |
256 KB |
Output is correct |
13 |
Incorrect |
4 ms |
256 KB |
Wrong DNA |
14 |
Incorrect |
5 ms |
384 KB |
Wrong DNA |
15 |
Correct |
5 ms |
256 KB |
Output is correct |
16 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
17 |
Incorrect |
5 ms |
384 KB |
Wrong DNA |
18 |
Incorrect |
5 ms |
384 KB |
Wrong DNA |
19 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
20 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
21 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
22 |
Correct |
5 ms |
256 KB |
Output is correct |
23 |
Correct |
5 ms |
256 KB |
Output is correct |
24 |
Correct |
5 ms |
256 KB |
Output is correct |
25 |
Correct |
5 ms |
256 KB |
Output is correct |
26 |
Correct |
5 ms |
256 KB |
Output is correct |
27 |
Correct |
5 ms |
256 KB |
Output is correct |
28 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
29 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
30 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
31 |
Incorrect |
5 ms |
384 KB |
Wrong DNA |
32 |
Incorrect |
5 ms |
384 KB |
Wrong DNA |
33 |
Correct |
5 ms |
256 KB |
Output is correct |
34 |
Correct |
5 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
6 ms |
304 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
4 ms |
256 KB |
Output is correct |
9 |
Correct |
5 ms |
256 KB |
Output is correct |
10 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
11 |
Correct |
5 ms |
256 KB |
Output is correct |
12 |
Correct |
5 ms |
256 KB |
Output is correct |
13 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
14 |
Correct |
5 ms |
256 KB |
Output is correct |
15 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
16 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
17 |
Incorrect |
6 ms |
256 KB |
Wrong DNA |
18 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
19 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
20 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
21 |
Incorrect |
5 ms |
256 KB |
Wrong DNA |
22 |
Incorrect |
14 ms |
384 KB |
Wrong DNA |
23 |
Incorrect |
14 ms |
384 KB |
Wrong DNA |
24 |
Incorrect |
14 ms |
384 KB |
Wrong DNA |
25 |
Incorrect |
18 ms |
384 KB |
Wrong DNA |
26 |
Incorrect |
16 ms |
368 KB |
Wrong DNA |
27 |
Correct |
11 ms |
384 KB |
Output is correct |
28 |
Correct |
11 ms |
384 KB |
Output is correct |
29 |
Correct |
5 ms |
384 KB |
Output is correct |
30 |
Correct |
11 ms |
384 KB |
Output is correct |
31 |
Correct |
12 ms |
384 KB |
Output is correct |
32 |
Correct |
5 ms |
384 KB |
Output is correct |
33 |
Incorrect |
14 ms |
384 KB |
Wrong DNA |
34 |
Incorrect |
16 ms |
384 KB |
Wrong DNA |
35 |
Incorrect |
13 ms |
384 KB |
Wrong DNA |
36 |
Incorrect |
15 ms |
384 KB |
Wrong DNA |
37 |
Incorrect |
12 ms |
384 KB |
Wrong DNA |
38 |
Correct |
16 ms |
384 KB |
Output is correct |
39 |
Correct |
10 ms |
384 KB |
Output is correct |