Submission #33861

# Submission time Handle Problem Language Result Execution time Memory
33861 2017-11-03T16:09:29 Z wan2000 Martian DNA (IOI16_dna) C++14
Compilation error
0 ms 0 KB
#include "grader.h"
#include <bits/stdc++.h>

using namespace std;

string analyse(int n, int t){
    string res = "";
    int l = 1, r = n, mid;
    int cur = 0;
    while(l<=r){
        mid = (l+r)>>1;
        if(make_test(add("",mid,'1'))){
            cur = mid;
            l = mid+1;
        }
        else r = mid-1;
    }
    res = add("",cur,'1');
    string tmp = res;
    int cnt = 0;
    while(tmp.size()<n){
        if(make_test(tmp+"0")){
            tmp += "0";
            cnt = 0;
        }
        else{
            tmp += "1";
            cnt++;
        }
        if(cnt>cur) break;
    }
    l = tmp.size()-cnt+1; r = tmp.size();
    int suf = tmp.size()-cnt;
    while(l<=r){
        mid = (l+r)>>1;
        string s = "";
        for(int i = 0; i < mid; i++){
            s += tmp[i];
        }
        if(make_test(s)){
            suf = mid;
            l = mid+1;
        }
        else r = mid-1;
    }
    res = "";
    for(int i = 0; i < suf; i++) res += tmp[i];
    while(res.size()<n){
        if(make_test("0"+res)) res = "0"+res;
        else res = "1"+res;
    }
    return res;
}

Compilation message

dna.cpp:1:20: fatal error: grader.h: No such file or directory
 #include "grader.h"
                    ^
compilation terminated.
grader.cpp: In function 'bool make_test(std::__cxx11::string)':
grader.cpp:14:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < p.size(); i++) {
                    ^
grader.cpp:23:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 1; i <= ss.size(); i++) {
                    ^
grader.cpp:28:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (pr[i] == p.size()) {
             ^