Submission #854103

#TimeUsernameProblemLanguageResultExecution timeMemory
854103TimDeePassword (RMI18_password)C++17
Compilation error
0 ms0 KiB
// Esti <3 //\ šťastia pre nás :) // you're already the best // _ // ^ ^ // // >(O_O)<___// // \ __ __ \ // \\ \\ \\\\ #include <bits/stdc++.h> using namespace std; //#pragma GCC optimize("O3","unroll-loops") //#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #pragma GCC optimize("O3") #pragma GCC target("popcnt") using ll = long long; #define int long long #define forn(i,n) for(int i=0; i<(n); ++i) #define pb push_back #define pi pair<int,int> #define f first #define s second #define vii(a,n) vector<int> a(n); forn(i,n) cin>>a[i]; #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); const int inf = 1e18; const int mod = 998244353; // \ \ :smiling_face_with_3_hearts: :smiling_face_with_3_hearts: :smiling_face_with_3_hearts: //vidime sa veľmi skoro, moje slnko string pass; int query(string s) { int n=s.size(); int m=pass.size(); int p=0; forn(i,n) { while (p<m && pass[p]!=s[i]) ++p; if (p>=m) return i; ++p; } return n; } void insert(string&s, int i, char c) { s+=c; for (int j=s.size()-1; j>i; --j) { swap(s[j],s[j-1]); } } string guess(int n, int s) { vector<int> cnt(26); for(char c='a'; c<='z'; ++c) { string s(n,c); int x = query(s); cnt[c-'a']=x; } vector<pi> v; forn(i,26) if (cnt[i]) v.pb({cnt[i],i}); sort(all(v)); int k=v.size(); string ans(v[0].f,(char)('a'+v[0].s)); for (int i=1; i<k; ++i) { char c = 'a'+v[i].s; int p=ans.size(); int last = query(ans); while (p>=0 && v[i].f) { auto old = ans; insert(ans,p,c); int x = query(ans); if (x > last) { last = x; --v[i].f; } else { ans = old; --p; } } string tmp(v[i].f,c); ans = tmp+ans; } return ans; }

Compilation message (stderr)

password.cpp:3:1: warning: multi-line comment [-Wcomment]
    3 | //\
      | ^
password.cpp:9:1: warning: multi-line comment [-Wcomment]
    9 | //   \ __ __  \
      | ^
password.cpp:36:1: warning: multi-line comment [-Wcomment]
   36 | // \
      | ^
/usr/bin/ld: /tmp/cczwex9y.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/ccueePcz.o:password.cpp:(.text+0x500): first defined here
/usr/bin/ld: /tmp/cczwex9y.o: in function `main':
grader.cpp:(.text.startup+0x66): undefined reference to `guess[abi:cxx11](int, int)'
collect2: error: ld returned 1 exit status