Submission #831616

# Submission time Handle Problem Language Result Execution time Memory
831616 2023-08-20T11:22:03 Z KemalK Martian DNA (IOI16_dna) C++17
11 / 100
20 ms 476 KB
#include "dna.h"
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;

std::string analyse(int n, int t) {
    string ans = "";
    if (n <= 5){
        bool ok = false;
        for (int mask = 0; mask < (1<<n) - 1; mask++){
            string cur = "";
            for (int j = 0; j < n; j++){
                if (mask>>j&1){
                    cur += "1";
                }
                else{
                    cur += "0";
                }
            }
            ok = make_test(cur);
            if (ok){
                return cur;
            }
        }
        if (!ok){
            for(int i = 0; i < n; i++){
                ans += "1";
            }
            return ans;
        }
    }
    bool left = true;
    bool right = true;
    while(ans.size() != n){
        if (ans.size() == 0){
            string cur = ans + "0";
            string cur2 = ans + "1";
            bool ok = make_test(cur);
            bool ok2 = make_test(cur2);
            if (!ok){
                for (int i = 0; i < n; i++){
                    ans += "1";
                }
                return ans;
            }
            else if (!ok2){
                for (int i = 0; i < n; i++){
                    ans += "0";
                }
                return ans;
            }
            ans += "0";
        }
        else{
            cout << "second " << "\n";
            if (left){
                string cur = ans + "1";
                string cur2 = ans + "0";
                bool ok = make_test(cur);
                bool ok2 = make_test(cur2);
                if (!ok and !ok2){
                    left = false;
                }
                else if (ok){
                    ans += "1";
                }
                else{
                    ans += "0";
                }
            }
            else{
                string cur = "0" + ans;
                string cur2 = "1" + ans;
                bool ok = make_test(cur);
                bool ok2 = make_test(cur2);
                if (ok){
                    ans = "0" + ans; 
                }
                else{
                    ans = "1" + ans;
                }
            }
        }
    }
    return ans;
}                       

Compilation message

dna.cpp: In function 'std::string analyse(int, int)':
dna.cpp:34:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |     while(ans.size() != n){
      |           ~~~~~~~~~~~^~~~
dna.cpp:75:22: warning: unused variable 'ok2' [-Wunused-variable]
   75 |                 bool ok2 = make_test(cur2);
      |                      ^~~
dna.cpp:33:10: warning: unused variable 'right' [-Wunused-variable]
   33 |     bool right = true;
      |          ^~~~~
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 296 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 300 KB Output is correct
5 Correct 0 ms 300 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 296 KB Output is correct
11 Correct 0 ms 304 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 240 KB Output is correct
15 Correct 1 ms 300 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 300 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 300 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 0 ms 304 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 300 KB Output is correct
7 Incorrect 0 ms 212 KB Secret is incorrect!
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Incorrect 0 ms 212 KB Secret is incorrect!
11 Incorrect 0 ms 212 KB Secret is incorrect!
12 Incorrect 0 ms 212 KB Secret is incorrect!
13 Incorrect 1 ms 212 KB Secret is incorrect!
14 Incorrect 0 ms 212 KB Secret is incorrect!
15 Incorrect 1 ms 212 KB Secret is incorrect!
16 Incorrect 1 ms 276 KB Secret is incorrect!
17 Incorrect 1 ms 292 KB Secret is incorrect!
18 Incorrect 1 ms 212 KB Secret is incorrect!
19 Incorrect 1 ms 212 KB Secret is incorrect!
20 Incorrect 1 ms 212 KB Secret is incorrect!
21 Incorrect 1 ms 212 KB Secret is incorrect!
22 Incorrect 1 ms 212 KB Secret is incorrect!
23 Incorrect 1 ms 300 KB Secret is incorrect!
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Incorrect 1 ms 304 KB Secret is incorrect!
27 Incorrect 1 ms 296 KB Secret is incorrect!
28 Incorrect 1 ms 212 KB Secret is incorrect!
29 Incorrect 1 ms 212 KB Secret is incorrect!
30 Incorrect 1 ms 212 KB Secret is incorrect!
31 Incorrect 1 ms 296 KB Secret is incorrect!
32 Incorrect 1 ms 212 KB Secret is incorrect!
33 Incorrect 1 ms 212 KB Secret is incorrect!
34 Incorrect 1 ms 300 KB Secret is incorrect!
# Verdict Execution time Memory Grader output
1 Correct 0 ms 296 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Correct 0 ms 304 KB Output is correct
5 Correct 0 ms 296 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Incorrect 0 ms 224 KB Secret is incorrect!
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Incorrect 0 ms 212 KB Secret is incorrect!
11 Incorrect 0 ms 212 KB Secret is incorrect!
12 Incorrect 0 ms 212 KB Secret is incorrect!
13 Incorrect 1 ms 308 KB Secret is incorrect!
14 Incorrect 0 ms 212 KB Secret is incorrect!
15 Incorrect 0 ms 212 KB Secret is incorrect!
16 Incorrect 0 ms 212 KB Secret is incorrect!
17 Incorrect 1 ms 212 KB Secret is incorrect!
18 Incorrect 1 ms 212 KB Secret is incorrect!
19 Incorrect 1 ms 212 KB Secret is incorrect!
20 Incorrect 1 ms 212 KB Secret is incorrect!
21 Incorrect 1 ms 296 KB Secret is incorrect!
22 Incorrect 14 ms 468 KB Secret is incorrect!
23 Incorrect 18 ms 360 KB Secret is incorrect!
24 Incorrect 18 ms 468 KB Secret is incorrect!
25 Incorrect 20 ms 432 KB Secret is incorrect!
26 Incorrect 14 ms 424 KB Secret is incorrect!
27 Incorrect 10 ms 428 KB Secret is incorrect!
28 Incorrect 10 ms 428 KB Secret is incorrect!
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Incorrect 11 ms 340 KB Secret is incorrect!
32 Incorrect 12 ms 420 KB Secret is incorrect!
33 Incorrect 15 ms 476 KB Secret is incorrect!
34 Incorrect 11 ms 448 KB Secret is incorrect!
35 Incorrect 11 ms 428 KB Secret is incorrect!
36 Incorrect 12 ms 468 KB Secret is incorrect!
37 Incorrect 11 ms 420 KB Secret is incorrect!
38 Incorrect 13 ms 428 KB Secret is incorrect!
39 Incorrect 13 ms 468 KB Secret is incorrect!