Submission #896431

# Submission time Handle Problem Language Result Execution time Memory
896431 2024-01-01T12:31:26 Z 3laa Art Collections (BOI22_art) C++17
Compilation error
0 ms 0 KB
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
#include <unordered_map>
#define endl '\n'
#define mid ((l+r)/2)
#define  F first
#define  S second
#define pb push_back
#define yes void (cout<<"YES"<<endl)
#define no void (cout<<"NO"<<endl)
#define ump unordered_map <ll,ll>
#define sp " "
#define vll vector<ll>
#define vint vector<int>
#define pll pair<ll,ll>
typedef long long ll;
using namespace std;
const ll inf=1e18+9;
const int N=2e5+9;
const ll M=1e9+7;
int n,m;
int publish(vint v){
    for(auto u : v)
        cout<<u+1<<sp;
    cout<<endl;
    int ret;
    cin>>ret;
    return ret;
}
void answer(vint v){
    for(auto u : v){
        cout<<u+1<<sp;
    }
    cout<<endl;
}
void solve(ll n){
    vint v;
    for(int i=0; i<n ; i++){
        v.pb(i);
    }
    v.resize(n);
    int ans=publish(v);
    for(int i=0 ; i<n ; i++){
        for(int j=0 ; j<n ; j++){
            if(i==j) continue;
            swap(v[i],v[j]);
            int x=publish(v);
            if(x<ans){
                ans=x;
                break;
            }
            else
                swap(v[i],v[j]);
        }
        if(ans==0)
            break;
    }
    answer(v);
}
int main(){
    int tt=1;
    //cin>>tt;
    while(tt--){
        cin>>n;
        solve(n);
    }

}

Compilation message

interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
/usr/bin/ld: /tmp/ccgdF7v0.o: in function `publish(std::vector<int, std::allocator<int> >)':
interface.cpp:(.text+0x60): multiple definition of `publish(std::vector<int, std::allocator<int> >)'; /tmp/ccTwB2p3.o:art.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccgdF7v0.o: in function `answer(std::vector<int, std::allocator<int> >)':
interface.cpp:(.text+0x170): multiple definition of `answer(std::vector<int, std::allocator<int> >)'; /tmp/ccTwB2p3.o:art.cpp:(.text+0xb0): first defined here
/usr/bin/ld: /tmp/ccgdF7v0.o: in function `main':
interface.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccTwB2p3.o:art.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccgdF7v0.o: in function `main':
interface.cpp:(.text.startup+0x16): undefined reference to `solve(int)'
collect2: error: ld returned 1 exit status