Submission #33862

#TimeUsernameProblemLanguageResultExecution timeMemory
33862wan2000Martian DNA (IOI16_dna)C++14
Compilation error
0 ms0 KiB
#include "dna.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 (stderr)

dna.cpp: In function 'std::__cxx11::string analyse(int, int)':
dna.cpp:12:36: error: 'add' was not declared in this scope
         if(make_test(add("",mid,'1'))){
                                    ^
dna.cpp:18:25: error: 'add' was not declared in this scope
     res = add("",cur,'1');
                         ^
dna.cpp:21:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(tmp.size()<n){
                     ^
dna.cpp:48:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(res.size()<n){
                     ^
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()) {
             ^