Submission #162295

#TimeUsernameProblemLanguageResultExecution timeMemory
162295popovicirobertMartian DNA (IOI16_dna)C++14
36 / 100
15 ms452 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; std::string analyse(int n, int t) { srand(time(NULL)); if(make_test("0") == 0) { string sol; sol.resize(n); fill(sol.begin(), sol.end(), '1'); return sol; } string sol = "0"; int cnt = 0; while(sol.size() < n) { sol.push_back(rand() % 2 + '0'); if(make_test(sol)) { cnt = 0; continue; } sol.back() = '0' + ((sol.back() - '0') ^ 1); cnt++; if(cnt == 12) { break; } } while(cnt > 0 && make_test(sol) == 0) { sol.pop_back(); cnt--; } while(sol.size() < n) { sol = "0" + sol; if(make_test(sol)) { continue; } sol[0] = '1'; } return sol; }

Compilation message (stderr)

dna.cpp: In function 'std::__cxx11::string analyse(int, int)':
dna.cpp:19:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(sol.size() < n) {
           ~~~~~~~~~~~^~~
dna.cpp:35:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(sol.size() < n) {
           ~~~~~~~~~~~^~~
grader.cpp: In function 'bool make_test(std::__cxx11::string)':
grader.cpp:14:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < p.size(); i++) {
                  ~~^~~~~~~~~~
grader.cpp:23:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 1; i <= ss.size(); i++) {
                  ~~^~~~~~~~~~~~
grader.cpp:28:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (pr[i] == p.size()) {
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...