#include "dna.h"
#include <bits/stdc++.h>
using namespace std;
string analyse(int n, int t) {
string s;
int l, r;
if (!make_test("0")) {
while (n--) s += "1";
return s;
}
for (int i=0; i<n; i++) s += "0";
l=1, r=n;
while (l < r) {
int mid = (l+r)/2;
if (make_test(s.substr(0, mid))) l = mid;
else r = mid-1;
}
int max0 = l;
s = s.substr(0, max0);
l=0;
while (l < max0) {
if (make_test(s + "1")) s += "1", l=0;
else s += "0", l++;
}
l=1, r=s.size();
while (l < r) {
int mid = (l+r)/2;
if (make_test(s.substr(0, mid))) l = mid+1;
else r = mid-1;
}
s = s.substr(0, l-1);
while (s.size() < n) s = (make_test("1"+s) ? "1" : "0") + s;
return s;
}
Compilation message
dna.cpp: In function 'std::string analyse(int, int)':
dna.cpp:36:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
36 | while (s.size() < n) s = (make_test("1"+s) ? "1" : "0") + s;
| ~~~~~~~~~^~~
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()) {
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Execution timed out |
1090 ms |
212 KB |
Time limit exceeded |
4 |
Execution timed out |
1080 ms |
212 KB |
Time limit exceeded |
5 |
Execution timed out |
1090 ms |
212 KB |
Time limit exceeded |
6 |
Correct |
1 ms |
304 KB |
Output is correct |
7 |
Execution timed out |
1084 ms |
212 KB |
Time limit exceeded |
8 |
Execution timed out |
1087 ms |
212 KB |
Time limit exceeded |
9 |
Execution timed out |
1067 ms |
212 KB |
Time limit exceeded |
10 |
Execution timed out |
1043 ms |
212 KB |
Time limit exceeded |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Incorrect |
1 ms |
212 KB |
Wrong DNA |
14 |
Execution timed out |
1092 ms |
212 KB |
Time limit exceeded |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Execution timed out |
1083 ms |
212 KB |
Time limit exceeded |
17 |
Execution timed out |
1086 ms |
212 KB |
Time limit exceeded |
18 |
Execution timed out |
1081 ms |
212 KB |
Time limit exceeded |
19 |
Execution timed out |
1081 ms |
212 KB |
Time limit exceeded |
20 |
Execution timed out |
1081 ms |
212 KB |
Time limit exceeded |
21 |
Execution timed out |
1083 ms |
212 KB |
Time limit exceeded |
22 |
Incorrect |
1 ms |
212 KB |
Wrong DNA |
23 |
Incorrect |
1 ms |
212 KB |
Wrong DNA |
24 |
Correct |
1 ms |
304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
296 KB |
Output is correct |
3 |
Execution timed out |
1076 ms |
212 KB |
Time limit exceeded |
4 |
Execution timed out |
1072 ms |
212 KB |
Time limit exceeded |
5 |
Execution timed out |
1089 ms |
212 KB |
Time limit exceeded |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Execution timed out |
1087 ms |
212 KB |
Time limit exceeded |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Execution timed out |
1091 ms |
212 KB |
Time limit exceeded |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Execution timed out |
1088 ms |
212 KB |
Time limit exceeded |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Execution timed out |
1090 ms |
212 KB |
Time limit exceeded |
14 |
Execution timed out |
1050 ms |
212 KB |
Time limit exceeded |
15 |
Execution timed out |
1084 ms |
212 KB |
Time limit exceeded |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Execution timed out |
1089 ms |
212 KB |
Time limit exceeded |
18 |
Incorrect |
1 ms |
300 KB |
Wrong DNA |
19 |
Incorrect |
1 ms |
212 KB |
Wrong DNA |
20 |
Execution timed out |
1067 ms |
212 KB |
Time limit exceeded |
21 |
Execution timed out |
1086 ms |
212 KB |
Time limit exceeded |
22 |
Execution timed out |
1076 ms |
212 KB |
Time limit exceeded |
23 |
Execution timed out |
1089 ms |
212 KB |
Time limit exceeded |
24 |
Execution timed out |
1087 ms |
212 KB |
Time limit exceeded |
25 |
Correct |
0 ms |
212 KB |
Output is correct |
26 |
Execution timed out |
1085 ms |
212 KB |
Time limit exceeded |
27 |
Execution timed out |
1095 ms |
212 KB |
Time limit exceeded |
28 |
Correct |
1 ms |
212 KB |
Output is correct |
29 |
Execution timed out |
1080 ms |
212 KB |
Time limit exceeded |
30 |
Incorrect |
1 ms |
212 KB |
Wrong DNA |
31 |
Execution timed out |
1086 ms |
304 KB |
Time limit exceeded |
32 |
Incorrect |
1 ms |
212 KB |
Wrong DNA |
33 |
Execution timed out |
1078 ms |
212 KB |
Time limit exceeded |
34 |
Execution timed out |
1083 ms |
212 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
304 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Execution timed out |
1075 ms |
212 KB |
Time limit exceeded |
4 |
Execution timed out |
1093 ms |
212 KB |
Time limit exceeded |
5 |
Execution timed out |
1096 ms |
212 KB |
Time limit exceeded |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Execution timed out |
1088 ms |
212 KB |
Time limit exceeded |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Execution timed out |
1093 ms |
212 KB |
Time limit exceeded |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Execution timed out |
1079 ms |
212 KB |
Time limit exceeded |
12 |
Incorrect |
1 ms |
212 KB |
Wrong DNA |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Execution timed out |
1096 ms |
212 KB |
Time limit exceeded |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Execution timed out |
1088 ms |
212 KB |
Time limit exceeded |
17 |
Incorrect |
1 ms |
212 KB |
Wrong DNA |
18 |
Execution timed out |
1085 ms |
300 KB |
Time limit exceeded |
19 |
Execution timed out |
1092 ms |
212 KB |
Time limit exceeded |
20 |
Execution timed out |
1081 ms |
212 KB |
Time limit exceeded |
21 |
Execution timed out |
1094 ms |
212 KB |
Time limit exceeded |
22 |
Execution timed out |
1082 ms |
212 KB |
Time limit exceeded |
23 |
Execution timed out |
1085 ms |
212 KB |
Time limit exceeded |
24 |
Incorrect |
9 ms |
340 KB |
Wrong DNA |
25 |
Incorrect |
12 ms |
320 KB |
Wrong DNA |
26 |
Execution timed out |
1079 ms |
296 KB |
Time limit exceeded |
27 |
Execution timed out |
1092 ms |
212 KB |
Time limit exceeded |
28 |
Execution timed out |
1040 ms |
212 KB |
Time limit exceeded |
29 |
Execution timed out |
1087 ms |
212 KB |
Time limit exceeded |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Execution timed out |
1086 ms |
212 KB |
Time limit exceeded |
32 |
Execution timed out |
1081 ms |
212 KB |
Time limit exceeded |
33 |
Correct |
8 ms |
340 KB |
Output is correct |
34 |
Correct |
9 ms |
340 KB |
Output is correct |
35 |
Correct |
7 ms |
340 KB |
Output is correct |
36 |
Execution timed out |
1083 ms |
212 KB |
Time limit exceeded |
37 |
Execution timed out |
1087 ms |
212 KB |
Time limit exceeded |
38 |
Execution timed out |
1088 ms |
212 KB |
Time limit exceeded |
39 |
Execution timed out |
1087 ms |
212 KB |
Time limit exceeded |