Submission #718000

#TimeUsernameProblemLanguageResultExecution timeMemory
718000fatemetmhrArt Collections (BOI22_art)C++17
70 / 100
2023 ms636 KiB
// Be name khoda //

#include "art.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define all(x) x.begin(), x.end()
#define pb     push_back
#define fi     first
#define se     second


vector <int> av, tmp;

void solve(int n){

    for(int i = 0; i < n; i++)
        av.pb(i + 1);

    int ans1, ans2;
    ans1 = publish(av);
    //cout << "here " << n << endl;
    for(int i = 1; i < n; i++){
        //cout << "ok " << i << endl;
        tmp.clear();
        tmp.pb(i + 1);
        for(int j = 0; j < n; j++) if(av[j] != i + 1)
            tmp.pb(av[j]);
        ans2 = publish(tmp);
        int x = (i + (ans1 - ans2)) / 2;
        int y = i - x;
        tmp.clear();
        for(int j = 0; j < n; j++) if(av[j] != i + 1){
            if(tmp.size() == y)
                tmp.pb(i + 1);
            tmp.pb(av[j]);
        }
        if(tmp.size() == y)
            tmp.pb(i + 1);
        av.clear();
        for(auto u : tmp)
            av.pb(u);
        ans1 -= x;
    }

    answer(av);
}

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:37:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |             if(tmp.size() == y)
      |                ~~~~~~~~~~~^~~~
art.cpp:41:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   41 |         if(tmp.size() == y)
      |            ~~~~~~~~~~~^~~~
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) {
      |        ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...