답안 #403958

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
403958 2021-05-13T15:53:41 Z Iwanttobreakfree Martian DNA (IOI16_dna) C++
36 / 100
1000 ms 960 KB
#include "dna.h"
#include <string>
#include <cstdlib>
#include <set>
using namespace std;
string analyse(int n, int t){
	int k;
	string str,prueba;
	bool first=false,posz,poso;
	set<string> s;
	while(true){
		
	poso=posz=true;
	if(str.length()==n)return str;
	if(!first){
		
	prueba=str+'0';
	k=prueba.length();	
	for(string x:s){
		int m=x.length();
		for(int i=0;i<k-m;i++){
			if(prueba.substr(i,m)==x){
				posz=false;
			}
		}
	}
	
	if(make_test(str+'0')&&posz){
		str+='0';
		continue;
	}
	else if(posz)s.insert(str+'0');
	
	prueba=str+'1';
	k=prueba.length();
	for(string x:s){
		int m=x.length();
		for(int i=0;i<k-m;i++){
			if(prueba.substr(i,m)==x){
				poso=false;
			}
		}
	}
	
	if(make_test(str+'1')&&poso){
		str+='1';
		continue;
	}
	else if(poso)s.insert(str+'1');
	first=true;
}

	if(first){
		
	prueba='0'+str;
	k=prueba.length();
	for(string x:s){
		int m=x.length();
		for(int i=0;i<k-m;i++){
			if(prueba.substr(i,m)==x){
				posz=false;
			}
		}
	}
	
	if(make_test('0'+str)&&posz){
		str='0'+str;
		continue;
	}
	else if(posz)s.insert('0'+str);
	
	prueba='1'+str;
	k=prueba.length();
	for(string x:s){
		int m=x.length();
		for(int i=0;i<k-m;i++){
			if(prueba.substr(i,m)==x){
				poso=false;
			}
		}
	}
	
	if(make_test('1'+str)&&poso){
		str='1'+str;
		continue;
	}
	else if(poso)s.insert('1'+str);
	}
}
}             

Compilation message

dna.cpp: In function 'std::string analyse(int, int)':
dna.cpp:14:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   14 |  if(str.length()==n)return str;
      |     ~~~~~~~~~~~~^~~
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 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 7 ms 316 KB Output is correct
18 Correct 7 ms 204 KB Output is correct
19 Correct 7 ms 204 KB Output is correct
20 Correct 5 ms 316 KB Output is correct
21 Correct 5 ms 308 KB Output is correct
22 Correct 6 ms 204 KB Output is correct
23 Correct 6 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 13 ms 320 KB Output is correct
26 Correct 12 ms 320 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 6 ms 204 KB Output is correct
29 Correct 7 ms 204 KB Output is correct
30 Correct 7 ms 204 KB Output is correct
31 Correct 6 ms 204 KB Output is correct
32 Correct 5 ms 320 KB Output is correct
33 Correct 3 ms 204 KB Output is correct
34 Correct 4 ms 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 7 ms 324 KB Output is correct
18 Correct 5 ms 316 KB Output is correct
19 Correct 7 ms 204 KB Output is correct
20 Correct 8 ms 332 KB Output is correct
21 Correct 6 ms 204 KB Output is correct
22 Execution timed out 1098 ms 548 KB Time limit exceeded
23 Execution timed out 1054 ms 588 KB Time limit exceeded
24 Execution timed out 1074 ms 428 KB Time limit exceeded
25 Execution timed out 1055 ms 540 KB Time limit exceeded
26 Execution timed out 1080 ms 436 KB Time limit exceeded
27 Execution timed out 1073 ms 504 KB Time limit exceeded
28 Execution timed out 1080 ms 560 KB Time limit exceeded
29 Correct 7 ms 332 KB Output is correct
30 Execution timed out 1094 ms 644 KB Time limit exceeded
31 Execution timed out 1087 ms 584 KB Time limit exceeded
32 Correct 7 ms 332 KB Output is correct
33 Execution timed out 1090 ms 708 KB Time limit exceeded
34 Execution timed out 1092 ms 600 KB Time limit exceeded
35 Execution timed out 1092 ms 552 KB Time limit exceeded
36 Execution timed out 1089 ms 460 KB Time limit exceeded
37 Execution timed out 1093 ms 580 KB Time limit exceeded
38 Execution timed out 1085 ms 960 KB Time limit exceeded
39 Execution timed out 1088 ms 708 KB Time limit exceeded