Submission #524110

#TimeUsernameProblemLanguageResultExecution timeMemory
524110RaresFelixMartian DNA (IOI16_dna)C++17
0 / 100
13 ms460 KiB
#include "dna.h" #include <cstdlib> using namespace std; string analyse(int n, int t) { string primsol = ""; for (int i = 1; i <= n; ++i) if (make_test(primsol + "0")) primsol += "0"; else primsol += "1"; int st = 1, dr = n, mij; while (st < dr) { mij = (st + dr + 1) / 2; if (make_test(primsol.substr(0, mij))) st = mij; else dr = mij - 1; } primsol = primsol.substr(0, st); for (int i = 1; i <= n - primsol.size(); ++i) if (make_test("0" + primsol)) primsol = "0" + primsol; else primsol = "1" + primsol; return primsol; }

Compilation message (stderr)

dna.cpp: In function 'std::string analyse(int, int)':
dna.cpp:21:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for (int i = 1; i <= n - primsol.size(); ++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...