Submission #598028

#TimeUsernameProblemLanguageResultExecution timeMemory
598028PyishtellMartian DNA (IOI16_dna)C++17
100 / 100
14 ms420 KiB
#include "dna.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; std::string analyse(int n, int t) { int start=0, end=n; while(end-start>1){ int middle=(start+end)/2; if(make_test(string(middle,'0'))) start=middle; else end=middle; } string s=string(start,'0'); int index=0; while(index<=start){ if(make_test(s+'1')) s=s+'1', index=0; else s=s+'0', index++; } start=s.size()-start-1, end=s.size(); while(end-start>1){ int middle=(start+end)/2; if(make_test(s.substr(0,middle))) start=middle; else end=middle; } s=s.substr(0,start); while(s.size()<n){ if(make_test('1'+s)) s='1'+s; else s='0'+s; } return s; }

Compilation message (stderr)

dna.cpp: In function 'std::string analyse(int, int)':
dna.cpp:27:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |     while(s.size()<n){
      |           ~~~~~~~~^~
grader.cpp: In function 'bool make_test(std::string)':
grader.cpp:14:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for (int i = 0; i < p.size(); i++) {
      |                  ~~^~~~~~~~~~
grader.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for (int i = 1; i <= ss.size(); i++) {
      |                  ~~^~~~~~~~~~~~
grader.cpp:28:13: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   if (pr[i] == p.size()) {
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...