Submission #439698

#TimeUsernameProblemLanguageResultExecution timeMemory
439698zxcvbnmMartian DNA (IOI16_dna)C++14
100 / 100
15 ms380 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; std::string analyse(int n, int t) { // randame ilgiausia eile, turincia tik nulius int l = 0, r = n+1, ans = 0; while(l <= r) { int mid = (l + r) / 2; if (make_test(string(mid, '0'))) { l = mid + 1; ans = mid; } else { r = mid - 1; } } if (ans == 0) { return string(n, '1'); } string str = string(ans, '0'); int rep = 0; int len = ans; while(rep <= len) { if (!make_test(str + "1")) { rep++; str += "0"; } else { rep = 0; str += "1"; } } str = str.substr(0, (int) str.length()-len-1); while(1) { if (!make_test(str + "0")) break; str += "0"; } while((int) str.length() < n) { if (make_test("1" + str)) { str = "1" + str; } else { str = "0" + str; } } return str; }

Compilation message (stderr)

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...