Submission #484409

# Submission time Handle Problem Language Result Execution time Memory
484409 2021-11-03T09:11:59 Z Carmel_Ab1 Martian DNA (IOI16_dna) C++17
11 / 100
12 ms 392 KB
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;
using namespace std;

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int>vi;
typedef vector<vector<int>>vvi;
typedef vector<ll>vl;
typedef vector<vl> vvl;
typedef pair<int,int>pi;
typedef pair<ll,ll> pl;
typedef vector<pl> vpl;
typedef vector<ld> vld;
typedef pair<ld,ld> pld;
typedef vector<pi> vpi;

//typedef tree<ll, null_type, less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
template<typename T> ostream& operator<<(ostream& os, vector<T>& a){os<<"[";for(int i=0; i<ll(a.size()); i++){os << a[i] << ((i!=ll(a.size()-1)?" ":""));}os << "]\n"; return os;}

#define all(x) x.begin(),x.end()
#define YES out("YES")
#define NO out("NO")
#define out(x){cout << x << "\n"; return;}
#define GLHF ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define print(x){for(auto ait:x) cout << ait << " "; cout << "\n";}
#define pb push_back
#define umap unordered_map

//#include "grader.cpp"
#include "dna.h"
string substr(string s,int l,int r){
    string ans;
    for(int i=l; i<=r; i++)
        ans+=s[i];
    return ans;
}
string analyse(int n, int t) {
    if(!make_test("0"))
        return string(n,'1');

    string ans;

    int wr=0;
    while(ans.size()<n && wr<13){
        char c='0';
        if(make_test(ans+c))
            ans+=c;
        else
            ans+=('1'+'0'-c),wr++;
    }

    int l=0,r=n-1;
    string x;
    while(l<=r){
        int m=(l+r)/2;
        if(make_test(substr(ans,0,m)))
            x=substr(ans,0,m),l=m+1;
        else
            r=m-1;
    }
    ans=x;
    while(ans.size()<n){
        if(make_test("0"+ans))
            ans="0"+ans;
        else
            ans="1"+ans;
    }
    return ans;

}

Compilation message

dna.cpp: In function 'std::string analyse(int, int)':
dna.cpp:49:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   49 |     while(ans.size()<n && wr<13){
      |           ~~~~~~~~~~^~
dna.cpp:67:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   67 |     while(ans.size()<n){
      |           ~~~~~~~~~~^~
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 204 KB Output is correct
2 Correct 0 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 1 ms 204 KB Output is correct
7 Correct 0 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 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 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 0 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 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Incorrect 1 ms 204 KB Wrong DNA
18 Incorrect 1 ms 204 KB Wrong DNA
19 Correct 1 ms 204 KB Output is correct
20 Incorrect 0 ms 204 KB Wrong DNA
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Incorrect 1 ms 204 KB Wrong DNA
24 Correct 0 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Incorrect 0 ms 204 KB Wrong DNA
27 Correct 0 ms 204 KB Output is correct
28 Incorrect 1 ms 204 KB Wrong DNA
29 Incorrect 0 ms 204 KB Wrong DNA
30 Incorrect 1 ms 204 KB Wrong DNA
31 Incorrect 0 ms 204 KB Wrong DNA
32 Incorrect 1 ms 204 KB Wrong DNA
33 Incorrect 0 ms 204 KB Wrong DNA
34 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 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 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 0 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 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 232 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Incorrect 1 ms 204 KB Wrong DNA
18 Incorrect 0 ms 204 KB Wrong DNA
19 Incorrect 0 ms 204 KB Wrong DNA
20 Incorrect 0 ms 204 KB Wrong DNA
21 Correct 1 ms 204 KB Output is correct
22 Incorrect 8 ms 300 KB Wrong DNA
23 Incorrect 9 ms 308 KB Wrong DNA
24 Incorrect 12 ms 332 KB Wrong DNA
25 Incorrect 11 ms 332 KB Wrong DNA
26 Incorrect 10 ms 392 KB Wrong DNA
27 Correct 6 ms 332 KB Output is correct
28 Incorrect 6 ms 384 KB Wrong DNA
29 Correct 5 ms 332 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Incorrect 8 ms 332 KB Wrong DNA
32 Correct 5 ms 332 KB Output is correct
33 Incorrect 7 ms 332 KB Wrong DNA
34 Incorrect 7 ms 332 KB Wrong DNA
35 Incorrect 7 ms 324 KB Wrong DNA
36 Incorrect 7 ms 364 KB Wrong DNA
37 Incorrect 7 ms 332 KB Wrong DNA
38 Incorrect 6 ms 332 KB Wrong DNA
39 Correct 7 ms 332 KB Output is correct