Submission #579628

#TimeUsernameProblemLanguageResultExecution timeMemory
579628JosiaArt Collections (BOI22_art)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

#define int int64_t


int nPublic;

bool compare(int a, int b) {
    vector<int> ask;

    for (int i = 0; i<nPublic; i++) {
        if (i+1 == a || i+1 == b) continue;
        ask.push_back(i+1);
    }

    ask.push_back(a);
    ask.push_back(b);
    int AB = publish(ask);
    ask.pop_back();
    ask.pop_back();
    ask.push_back(b);
    ask.push_back(a);
    int BA = publish(ask);

    return AB < BA;
}



void solve(int n) {
    nPublic = n;
    vector<int> a;
    for (int i=0; i<n; i++) a.push_back(i+1);

    sort(a.begin(), a.end(), compare);

    answer(ask);
}



// signed main() {
//     cin.tie(0);
//     ios_base::sync_with_stdio(0);

//     int n; cin >> n;

//     deque<int> a(n);

//     for (int i = 0; i<n; i++) cin >> a[i];

//     for (int i = 0; i<n; i++) {
//         int cnt = 0;
//         for (int i = 0; i<n; i++) {
//             for (int j = i+1; j<n; j++) {
//                 if (a[i]>a[j]) cnt++;
//             }
//         }
//         a.push_back(a[0]);
//         a.pop_front();
//         cout << cnt << "\n";
//     }

//     return 0;
// }

Compilation message (stderr)

art.cpp: In function 'bool compare(int64_t, int64_t)':
art.cpp:20:14: error: 'publish' was not declared in this scope
   20 |     int AB = publish(ask);
      |              ^~~~~~~
art.cpp: In function 'void solve(int64_t)':
art.cpp:39:12: error: 'ask' was not declared in this scope
   39 |     answer(ask);
      |            ^~~
art.cpp:39:5: error: 'answer' was not declared in this scope
   39 |     answer(ask);
      |     ^~~~~~
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) {
      |        ~~~~~~~~~^~~~