Submission #519403

# Submission time Handle Problem Language Result Execution time Memory
519403 2022-01-26T10:15:08 Z hohohaha Traffickers (RMI18_traffickers) C++14
Compilation error
0 ms 0 KB
/// Zengy MANGA
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
 
#include "bits/stdc++.h"
 
using namespace std;
 
#define pb push_back
#define F first
#define S second
#define f(i, a, b)  for(int i = a; i < b; i++)
#define all(a)  a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define mp(x,y) make_pair(x,y)
#define popCnt(x) (__builtin_popcountll(x))
 
using ll = long long;
using ii = pair<int,int>;
using ull = unsigned long long;
using db = long double;
 
const int N = 2e5+5, LG = 18, MOD = 998244353;
const long double PI = acos(-1);
 
int query(string s);
 
using is = pair<int, string>;
 
priority_queue<is, vector<is>, greater<is>> pq;
 
string mrg(string s1, string s2) {
    for(int i = s1.size(); i > 0 && s2.size(); --i) {
        for(int j = 1; j <= s2.size() + 1; j++) {
            if(j > s2.size() || query(s1.substr(0,i) + s2.substr(s2.size()-j) + s1.substr(i)) != s1.size() + j) {
                s1 = s1.substr(0,i) + s2.substr(s2.size()-(j-1)) + s1.substr(i);
                f(k,0,j-1)s2.pop_back();
                break;
            }
        }
    }
    return s2+s1;
}
 
string guess(int n, int s) {
 
    f(i,0,s) {
        string str = string(query(string(n, 'a' + i)), 'a' + i);
        if(str.size())
        pq.push(make_pair(str.size(), str));
    }
 
    while(sz(pq) > 1) {
 
        auto cur2 = pq.top().second; pq.pop();
        auto cur1 = pq.top().second; pq.pop();
 
        string ans = mrg(cur1, cur2);
 
        pq.push(mp(sz(ans), ans));
    }
 
    return pq.top().second;
}

Compilation message

traffickers.cpp: In function 'std::string mrg(std::string, std::string)':
traffickers.cpp:36:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         for(int j = 1; j <= s2.size() + 1; j++) {
      |                        ~~^~~~~~~~~~~~~~~~
traffickers.cpp:37:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             if(j > s2.size() || query(s1.substr(0,i) + s2.substr(s2.size()-j) + s1.substr(i)) != s1.size() + j) {
      |                ~~^~~~~~~~~~~
traffickers.cpp:37:95: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             if(j > s2.size() || query(s1.substr(0,i) + s2.substr(s2.size()-j) + s1.substr(i)) != s1.size() + j) {
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
/usr/bin/ld: /tmp/ccbeVxpY.o: in function `mrg(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
traffickers.cpp:(.text+0x643): undefined reference to `query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: /tmp/ccbeVxpY.o: in function `guess[abi:cxx11](int, int)':
traffickers.cpp:(.text+0x13e2): undefined reference to `query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: error: ld returned 1 exit status