Submission #423524

#TimeUsernameProblemLanguageResultExecution timeMemory
423524victoriadMartian DNA (IOI16_dna)C++14
36 / 100
26 ms384 KiB
#include "dna.h" #include <cstdlib> using namespace std; std::string analyse(int n, int t) { string s; string pr; int x=0; pr.push_back('0'); if(make_test(pr)){ x++; bool final=false; bool principio=false; s=pr; while(x<n){ pr=s; if(!final){ pr.push_back('0'); if(make_test(pr)){ s=pr; x++; } else{ pr.pop_back(); pr.push_back('1'); if(make_test(pr)){ s=pr; x++; } else{ final=true; } } } if(!principio){ string p; p.push_back('0'); for(int i=0;i<s.size();i++)p.push_back(s[i]); if(make_test(p)){ s=p; x++; } else{ p[0]='1'; if(make_test(p)){ s=p; x++; } else{ principio=true; } } } } } else{ for(int i=0;i<n;i++)s.push_back('1'); } return s; }

Compilation message (stderr)

dna.cpp: In function 'std::string analyse(int, int)':
dna.cpp:38:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for(int i=0;i<s.size();i++)p.push_back(s[i]);
      |                 ~^~~~~~~~~
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...