Submission #127538

#TimeUsernameProblemLanguageResultExecution timeMemory
127538Osama_AlkhodairyMartian DNA (IOI16_dna)C++17
100 / 100
15 ms416 KiB
#include <bits/stdc++.h> #include "dna.h" //~ #include "grader.cpp" using namespace std; std::string analyse(int n, int t) { int l = 0, r = n; while(l <= r){ int mid = (l + r) / 2; if(make_test(string(mid, '0'))) l = mid + 1; else r = mid - 1; } string ret = string(r, '0'); int zeros = 0; while(ret.size() != n){ if(make_test("1" + ret)){ ret = '1' + ret; zeros = 0; } else{ ret = '0' + ret; zeros++; } if(zeros > r) break; } l = 0, r = (int)ret.size() - 1; while(l <= r){ int mid = (l + r) / 2; if(make_test(ret.substr(mid))) r = mid - 1; else l = mid + 1; } ret = ret.substr(l); while(ret.size() != n){ if(make_test(ret + "0")) ret += '0'; else ret += '1'; } return ret; }

Compilation message (stderr)

dna.cpp: In function 'std::__cxx11::string analyse(int, int)':
dna.cpp:15:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(ret.size() != n){
           ~~~~~~~~~~~^~~~
dna.cpp:33:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(ret.size() != n){
           ~~~~~~~~~~~^~~~
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...