Submission #484376

#TimeUsernameProblemLanguageResultExecution timeMemory
484376Carmel_Ab1Martian DNA (IOI16_dna)C++17
0 / 100
1096 ms588 KiB
#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 analyse(int n, int t) { string ans="0"; if(!make_test("0")) return string(n,'1'); while(1) { while (ans.size() < n) { if (make_test(ans + "0")) ans += '0'; else ans += "1"; } int l = 1, r = n, sz = -1; while (l <= r) { int m = (l + r) / 2; if (make_test(ans.substr(0, m - 1))) sz = m - 1, l = m + 1; else r = m - 1; } char c='0'; if(ans.size()!=n) c='0'+'1'-ans[sz+1]; ans = ans.substr(0, sz); if(ans.size()==n) break; if(!make_test(ans+c)) break; } while(1){ if(make_test("0"+ans)) ans="0"+ans; else if(make_test("1"+ans)) ans="1"+ans; else break; } assert(ans.size()==n); return ans; }

Compilation message (stderr)

dna.cpp: In function 'std::string analyse(int, int)':
dna.cpp:42:27: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |         while (ans.size() < n) {
      |                ~~~~~~~~~~~^~~
dna.cpp:59:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   59 |         if(ans.size()!=n)
      |            ~~~~~~~~~~^~~
dna.cpp:62:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   62 |         if(ans.size()==n)
      |            ~~~~~~~~~~^~~
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from dna.cpp:1:
dna.cpp:75:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   75 |     assert(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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...