Submission #423536

# Submission time Handle Problem Language Result Execution time Memory
423536 2021-06-11T09:00:06 Z victoriad Martian DNA (IOI16_dna) C++14
11 / 100
1000 ms 836 KB
#include "dna.h"
#include <vector>
#include <cstdlib>
using namespace std;
std::string analyse(int n, int t) {
    vector<string>r;
	string s;
	string pr;
	int x=0;
	pr.push_back('0');
	if(make_test(pr)){
		x++;
		bool final=false;
		bool principio=false;
		s=pr;
		while(x<n){
			pr=s;
			if(!final){
			pr.push_back('0');
			bool b=true;
			for(int i=0;i<r.size();i++){
				bool h=false;
				for(int k=0;k<r.size();k++){
					if(r[i][r.size()-1-k]!=pr[pr.size()-1-k]){
						h=true;
						break;
					}
				}
				if(!h){
					b=false;
					break;
				}
			}
			if(b)b=make_test(pr);
			if(b){
				s=pr;
				x++;
			}
			else{
				r.push_back(pr);
				pr.pop_back();
				pr.push_back('1');
				bool b=true;
				for(int i=0;i<r.size();i++){
				bool h=false;
				for(int k=0;k<r.size();k++){
					if(r[i][r.size()-1-k]!=pr[pr.size()-1-k]){
						h=true;
						break;
					}
				}
				if(!h){
					b=false;
					break;
				}
					}
				if(b)b=make_test(pr);
				if(b){
					s=pr;
					x++;
				}
				else{
					r.push_back(pr);
					final=true;
				}
			}
			}
			if(!principio){
				string p;
				p.push_back('0');
				for(int i=0;i<s.size();i++)p.push_back(s[i]);
				bool b=true;
				for(int i=0;i<r.size();i++){
				bool h=false;
				for(int k=0;k<r.size();k++){
					if(r[i][k]!=p[k]){
						h=true;
						break;
					}
				}
				if(!h){
					b=false;
					break;
				}
				}
				if(b)b=make_test(p);
				if(b){
					s=p;
					x++;
				}
				else{
					r.push_back(p);
					p[0]='1';
					bool b=true;
					for(int i=0;i<r.size();i++){
					bool h=false;
					for(int k=0;k<r.size();k++){
					if(r[i][k]!=p[k]){
						h=true;
						break;
					}
					}
					if(!h){
					b=false;
					break;
					}
					}
					if(b)b=make_test(p);
					if(b){
						s=p;
						x++;
					}
					else{
						r.push_back(p);
						principio=true;
					}
				}

			}
			
		}
	}
	else{
		for(int i=0;i<n;i++)s.push_back('1');
	}
	return s;
}

Compilation message

dna.cpp: In function 'std::string analyse(int, int)':
dna.cpp:21:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |    for(int i=0;i<r.size();i++){
      |                ~^~~~~~~~~
dna.cpp:23:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int k=0;k<r.size();k++){
      |                 ~^~~~~~~~~
dna.cpp:44:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     for(int i=0;i<r.size();i++){
      |                 ~^~~~~~~~~
dna.cpp:46:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     for(int k=0;k<r.size();k++){
      |                 ~^~~~~~~~~
dna.cpp:71:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |     for(int i=0;i<s.size();i++)p.push_back(s[i]);
      |                 ~^~~~~~~~~
dna.cpp:73:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |     for(int i=0;i<r.size();i++){
      |                 ~^~~~~~~~~
dna.cpp:75:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   75 |     for(int k=0;k<r.size();k++){
      |                 ~^~~~~~~~~
dna.cpp:95:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   95 |      for(int i=0;i<r.size();i++){
      |                  ~^~~~~~~~~
dna.cpp:97:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   97 |      for(int k=0;k<r.size();k++){
      |                  ~^~~~~~~~~
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
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 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 0 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 0 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 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 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 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 Execution timed out 1089 ms 204 KB Time limit exceeded
15 Execution timed out 1087 ms 204 KB Time limit exceeded
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 Execution timed out 1085 ms 204 KB Time limit exceeded
22 Execution timed out 1083 ms 204 KB Time limit exceeded
23 Execution timed out 1088 ms 204 KB Time limit exceeded
24 Correct 1 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Execution timed out 1087 ms 204 KB Time limit exceeded
31 Execution timed out 1085 ms 204 KB Time limit exceeded
32 Execution timed out 1097 ms 204 KB Time limit exceeded
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Execution timed out 1086 ms 204 KB Time limit exceeded
15 Execution timed out 1080 ms 204 KB Time limit exceeded
16 Execution timed out 1081 ms 204 KB Time limit exceeded
17 Correct 1 ms 204 KB Output is correct
18 Execution timed out 1092 ms 204 KB Time limit exceeded
19 Correct 1 ms 204 KB Output is correct
20 Execution timed out 1093 ms 204 KB Time limit exceeded
21 Execution timed out 1082 ms 204 KB Time limit exceeded
22 Incorrect 15 ms 588 KB Too many tests
23 Execution timed out 1076 ms 204 KB Time limit exceeded
24 Incorrect 28 ms 628 KB Too many tests
25 Incorrect 32 ms 548 KB Too many tests
26 Execution timed out 1077 ms 204 KB Time limit exceeded
27 Execution timed out 1087 ms 204 KB Time limit exceeded
28 Execution timed out 1083 ms 204 KB Time limit exceeded
29 Correct 8 ms 332 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Incorrect 86 ms 836 KB Too many tests
32 Correct 8 ms 332 KB Output is correct
33 Incorrect 17 ms 628 KB Too many tests
34 Incorrect 18 ms 540 KB Too many tests
35 Execution timed out 1078 ms 332 KB Time limit exceeded
36 Execution timed out 1063 ms 332 KB Time limit exceeded
37 Execution timed out 1083 ms 204 KB Time limit exceeded
38 Incorrect 12 ms 716 KB Too many tests
39 Incorrect 33 ms 748 KB Too many tests