Submission #1293551

#TimeUsernameProblemLanguageResultExecution timeMemory
1293551hyakupMartian DNA (IOI16_dna)C++20
100 / 100
8 ms476 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; string analyse(int n, int t) { mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int max_wrong = 12; int wrong_count = 0; string s; // Solve Prefix while(wrong_count < max_wrong){ int bit = rng()%2; s = (char)('0' + bit) + s; if( make_test(s) ) wrong_count = 0; else{ wrong_count++; s[0] = (char)('0' + 1 - bit); } } // Solve Wrong vector<char> wrong_bits; for( int i = 0; i < max_wrong; i++ ) wrong_bits.push_back(s[i]); s.erase(s.begin(), s.begin() + max_wrong); while( wrong_count > 0 ){ s = wrong_bits.back() + s; wrong_bits.pop_back(); if( !make_test(s) ) break; wrong_count--; } s.erase(s.begin()); // Solve Suffix while( s.size() < n ){ s.push_back('0'); if( !make_test(s) ) s.back() = '1'; } return s; }

Compilation message (stderr)

dna.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...