Submission #562975

#TimeUsernameProblemLanguageResultExecution timeMemory
562975Spade1Martian DNA (IOI16_dna)C++14
0 / 100
1098 ms556 KiB
#include<bits/stdc++.h> #include "dna.h" #define pii pair<int, int> #define pll pair<long long, long long> #define ll long long #define ld long double #define st first #define nd second #define pb push_back #define INF INT_MAX using namespace std; string analyse(int n, int t) { int l = 0, r = n; while (l < r) { int mid = (l+r)/2; string test; for (int i = 1; i <= mid; ++i) test += "1"; if (make_test(test)) l = mid; else r = mid-1; } int _max = l; string s; for (int i = 1; i <= _max; ++i) s += "1"; int cnt = _max; while (cnt <= _max) { if (make_test(s + "0")) { s += "0"; cnt = 0; } else { s += "1"; cnt++; } } while (!s.empty() && s.back() == '1') { s.erase(s.back()); } l = 0, r = _max; while (l < r) { int mid = (l+r)/2; string test = s; for (int i = 1; i <= mid; ++i) test += "1"; if (make_test(test)) l = mid; else r = mid-1; } for (int i = 1; i <= l; ++i) s += "1"; while (s.size() < n) { if (make_test("0" + s)) s = "0" + s; else s = "1" + s; } return s; }

Compilation message (stderr)

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