Submission #773125

#TimeUsernameProblemLanguageResultExecution timeMemory
773125aykhnPassword (RMI18_password)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> // author: aykhn using namespace std; using namespace __gnu_pbds; typedef long long ll; #define TC int t; cin >> t; while (t--) _(); #define OPT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> #define ordered_setp tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> #define all(v) v.begin(), v.end() #define pii pair<int, int> #define mpr make_pair #define eb emplace_back #define new int32_t #define pb push_back #define ts to_string #define int ll #define fi first #define se second #define ins insert #define inf 0x3F3F3F3F #define infll 0x3F3F3F3F3F3F3F3FLL #define bpc __builtin_popcount int query(string str); string guess(int n, int s) { string ans = ""; int prev; string x = "a"; for (int i = 0; i < s; i++) { ans = x + ans; int X = query(ans); prev = max(X, prev); if (!X) ans = ans.substr(1, (int)(ans.length()) - 1); for (int j = 1; j <= ans.length(); j++) { string asd = ans.substr(0, j); string assd = ans.substr(j, (int)ans.length() - j); ans = asd; asd += x; asd += assd; int y = query(ans); if (y <= prev) { asd = ans.substr(0, j); assd = ans.substr(j + 1, (int)ans.length() - j - 1); ans = asd + assd; } } x[0]++; } return ans; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(ll, ll)':
password.cpp:46:27: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |         for (int j = 1; j <= ans.length(); j++)
      |                         ~~^~~~~~~~~~~~~~~
password.cpp:36:9: warning: 'prev' may be used uninitialized in this function [-Wmaybe-uninitialized]
   36 |     int prev;
      |         ^~~~
/usr/bin/ld: /tmp/ccsWPKNJ.o: in function `main':
grader.cpp:(.text.startup+0x66): undefined reference to `guess[abi:cxx11](int, int)'
collect2: error: ld returned 1 exit status