Submission #423536

#TimeUsernameProblemLanguageResultExecution timeMemory
423536victoriadMartian DNA (IOI16_dna)C++14
11 / 100
1097 ms836 KiB
#include "dna.h" #include <vector> #include <cstdlib> using namespace std; std::string analyse(int n, int t) { vector<string>r; 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'); bool b=true; for(int i=0;i<r.size();i++){ bool h=false; for(int k=0;k<r.size();k++){ if(r[i][r.size()-1-k]!=pr[pr.size()-1-k]){ h=true; break; } } if(!h){ b=false; break; } } if(b)b=make_test(pr); if(b){ s=pr; x++; } else{ r.push_back(pr); pr.pop_back(); pr.push_back('1'); bool b=true; for(int i=0;i<r.size();i++){ bool h=false; for(int k=0;k<r.size();k++){ if(r[i][r.size()-1-k]!=pr[pr.size()-1-k]){ h=true; break; } } if(!h){ b=false; break; } } if(b)b=make_test(pr); if(b){ s=pr; x++; } else{ r.push_back(pr); final=true; } } } if(!principio){ string p; p.push_back('0'); for(int i=0;i<s.size();i++)p.push_back(s[i]); bool b=true; for(int i=0;i<r.size();i++){ bool h=false; for(int k=0;k<r.size();k++){ if(r[i][k]!=p[k]){ h=true; break; } } if(!h){ b=false; break; } } if(b)b=make_test(p); if(b){ s=p; x++; } else{ r.push_back(p); p[0]='1'; bool b=true; for(int i=0;i<r.size();i++){ bool h=false; for(int k=0;k<r.size();k++){ if(r[i][k]!=p[k]){ h=true; break; } } if(!h){ b=false; break; } } if(b)b=make_test(p); if(b){ s=p; x++; } else{ r.push_back(p); 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:21:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |    for(int i=0;i<r.size();i++){
      |                ~^~~~~~~~~
dna.cpp:23:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int k=0;k<r.size();k++){
      |                 ~^~~~~~~~~
dna.cpp:44:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     for(int i=0;i<r.size();i++){
      |                 ~^~~~~~~~~
dna.cpp:46:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     for(int k=0;k<r.size();k++){
      |                 ~^~~~~~~~~
dna.cpp:71:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |     for(int i=0;i<s.size();i++)p.push_back(s[i]);
      |                 ~^~~~~~~~~
dna.cpp:73:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |     for(int i=0;i<r.size();i++){
      |                 ~^~~~~~~~~
dna.cpp:75:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   75 |     for(int k=0;k<r.size();k++){
      |                 ~^~~~~~~~~
dna.cpp:95:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   95 |      for(int i=0;i<r.size();i++){
      |                  ~^~~~~~~~~
dna.cpp:97:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   97 |      for(int k=0;k<r.size();k++){
      |                  ~^~~~~~~~~
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...