제출 #593273

#제출 시각아이디문제언어결과실행 시간메모리
593273ignaciocantaMartian DNA (IOI16_dna)C++14
100 / 100
13 ms388 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; #define SZ(v) int((v).size()) #define F0R(i, a) for(int i = (0); i < int(a); ++i) string analyse(int n, int t) { int low = 0, high = n+1; while(high - low > 1) { int mid = low + (high - low) / 2; if(make_test(string(mid, '0'))) low = mid; else high = mid; } int maxZeros = low; if(maxZeros == 0) { return string(n, '1'); } string curRet = string(maxZeros, '0'); int curZeroLen = 0; while(SZ(curRet) < n && curZeroLen <= maxZeros){ if(make_test(curRet + string(curZeroLen, '0') + '1')) { curRet += string(curZeroLen, '0') + '1'; curZeroLen = 0; } else { ++curZeroLen; } } low = 0, high = min(n - SZ(curRet), curZeroLen) + 1; while(high - low > 1) { int mid = low + (high - low) / 2; if(make_test(curRet + string(mid, '0'))) low = mid; else high = mid; } curRet += string(low, '0'); int len = SZ(curRet); F0R(i, n - len){ if(make_test('1' + curRet)) curRet = '1' + curRet; else curRet = '0' + curRet; } return curRet; }

컴파일 시 표준 에러 (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...