Submission #242702

#TimeUsernameProblemLanguageResultExecution timeMemory
242702HynDufMartian DNA (IOI16_dna)C++14
0 / 100
18 ms512 KiB
#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 (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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...