Submission #1091360

# Submission time Handle Problem Language Result Execution time Memory
1091360 2024-09-20T17:00:45 Z kotnid Martian DNA (IOI16_dna) C++14
36 / 100
11 ms 1116 KB
#include <bits/stdc++.h>
using namespace std;

set<string>st;

bool make_test(string p);

int T = 0;
// bool f(string s){
//     string ans = "0";
//     if(st.find(s) != st.end())return 0;
//     cout << "? " << s << endl;
//     T++;
//     return (ans.find(s) != string::npos);
// }

bool f(string s){
    if(st.find(s) != st.end())return 0;
    // cout << "? " << s << endl;
    return make_test(s);
    // bool v;
    // cin >> v;
    // return v;
}

string analyse(int n, int t){
    st.clear();
    int len0 = 0;
    string s = "0";
    while(s.size() <= n && f(s)){
        len0++;
        s += "0";
    }
    st.insert(s);
    s.pop_back();

    if(len0 == 0){
        string s2 = "";
        for(int i=0; i<n; i++)s2 += "1";
        return s2;
        // cout << "! ";
        // for(int i=0; i<n; i++)cout << 1;
        // cout << endl;
        // return ;
    }
    // right side
    int flag = 1;
    int cnt = 0;
    while(1){
        s += (char)(flag+'0');
        cnt++;
        if(!(!flag && cnt > len0) && s.size() <= n && f(s))continue;
        st.insert(s);
        s.pop_back();
        flag = 1-flag;
        s += (char)(flag+'0');
        cnt = 1;
        if(!(!flag && cnt > len0) && s.size() <= n && f(s))continue;
        st.insert(s);
        s.pop_back();
        break;
    }

    flag = 1;
    cnt = 0;
    while(1){
        s.insert(0, string(1,(char)(flag+'0')));
        cnt++;
        if(!(!flag && cnt > len0) && s.size() <= n && f(s))continue;
        st.insert(s);
        s.erase(s.begin());
        flag = 1-flag;
        s.insert(0, string(1,(char)(flag+'0')));
        cnt = 1;
        if(!(!flag && cnt > len0) && s.size() <= n && f(s))continue;
        st.insert(s);
        s.erase(s.begin());
        break;
    }

    return s;
    // cout << T << endl;
}

// int main(){
//     int t;
//     cin >> t;
//     while(t--)solve();
// }

Compilation message

dna.cpp: In function 'std::string analyse(int, int)':
dna.cpp:30:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |     while(s.size() <= n && f(s)){
      |           ~~~~~~~~~^~~~
dna.cpp:52:47: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   52 |         if(!(!flag && cnt > len0) && s.size() <= n && f(s))continue;
      |                                      ~~~~~~~~~^~~~
dna.cpp:58:47: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   58 |         if(!(!flag && cnt > len0) && s.size() <= n && f(s))continue;
      |                                      ~~~~~~~~~^~~~
dna.cpp:69:47: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   69 |         if(!(!flag && cnt > len0) && s.size() <= n && f(s))continue;
      |                                      ~~~~~~~~~^~~~
dna.cpp:75:47: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   75 |         if(!(!flag && cnt > len0) && s.size() <= n && f(s))continue;
      |                                      ~~~~~~~~~^~~~
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 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 360 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 0 ms 432 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 440 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Incorrect 7 ms 604 KB Too many tests
23 Incorrect 7 ms 604 KB Too many tests
24 Incorrect 7 ms 600 KB Too many tests
25 Incorrect 11 ms 604 KB Too many tests
26 Incorrect 11 ms 604 KB Too many tests
27 Incorrect 9 ms 1116 KB Too many tests
28 Incorrect 5 ms 1108 KB Too many tests
29 Correct 3 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 3 ms 348 KB Output is correct
32 Correct 3 ms 348 KB Output is correct
33 Incorrect 8 ms 860 KB Too many tests
34 Incorrect 8 ms 1112 KB Too many tests
35 Incorrect 8 ms 916 KB Too many tests
36 Incorrect 8 ms 1016 KB Too many tests
37 Incorrect 7 ms 1116 KB Too many tests
38 Correct 3 ms 348 KB Output is correct
39 Correct 4 ms 344 KB Output is correct