이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |