Submission #773129

#TimeUsernameProblemLanguageResultExecution timeMemory
773129TheSahibPassword (RMI18_password)C++14
Compilation error
0 ms0 KiB
#include "grader.cpp" #include <bits/stdc++.h> #define ll long long #define pii pair<int, int> using namespace std; int cnt[30]; string guess(int n, int s){ for (int c = 'a'; c < 'a' + s; c++) { string a; for (int i = 0; i < n; i++) { a += c; } int b = query(a); cnt[c - 'a'] = b; } string ans; while(cnt[0]--){ ans += 'a'; } for(char c = 'b'; c < 'a' + s; c++){ while(cnt[c - 'a']--){ int l = 0, r = ans.size(); int a = 0; while(l <= r){ int mid = (l + r) / 2; string slice; for(int i = l; i <= mid; i++){ slice += ans[i]; } slice += c; int b = query(slice); if(b == slice.size()){ l = mid + 1; a = mid; } else{ r = mid - 1; } } ans.insert(ans.begin() + a, c); } } return ans; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:38:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |                 if(b == slice.size()){
      |                    ~~^~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccRlwApU.o: in function `query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x80): multiple definition of `query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/cc0O8CIT.o:password.cpp:(.text+0x240): first defined here
/usr/bin/ld: /tmp/ccRlwApU.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc0O8CIT.o:password.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status