Submission #433404

#TimeUsernameProblemLanguageResultExecution timeMemory
433404KanaifuMartian DNA (IOI16_dna)C++14
0 / 100
14 ms496 KiB
#include <bits/stdc++.h> #include "dna.h" #include <cstdlib> //#include "grader.cpp" using namespace std; mt19937 randseed(time(nullptr)); std::string analyse(int n, int t) { bool suff = false; int last = 0; string sub = ""; string las = ""; while (sub.size()<n) { if (suff) { sub = "0" + sub; if (!make_test(sub)) { sub[0] = '1'; } continue; } int koristi = randseed() % 2; if (koristi) { sub += "1"; if (make_test(sub)) { las = sub; last = 0; } else { sub[sub.size()-1] = '0'; last++; if (last>20) { suff=true; sub = las; continue; } } } else { sub += "0"; if (make_test(sub)) { las = sub; last = 0; } else { sub[sub.size()-1] = '1'; last++; if (last>20) { suff=true; sub = las; continue; } } } } return sub; }

Compilation message (stderr)

dna.cpp: In function 'std::string analyse(int, int)':
dna.cpp:16:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |     while (sub.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...