Submission #1120881

#TimeUsernameProblemLanguageResultExecution timeMemory
1120881vjudge1Art Collections (BOI22_art)C++17
0 / 100
1 ms336 KiB
// Bolatulu
#include <bits/stdc++.h>
#include "art.h"

/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/

typedef long long ll;
typedef unsigned long long ull; 
typedef double db;
#define pb push_back
#define eb emplace_back
#define ins insert
#define F first
#define S second
#define md (tl+tr)/2
#define TL v+v,tl,md
#define TR v+v+1,md+1,tr
#define Tl t[v].l,tl,md
#define Tr t[v].r,md+1,tr
#define all(x) (x).begin(),(x).end()
#define yes cout << "YES\n"
#define no cout << "NO\n"
// #define int long long
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout);
#define ld long double
using namespace std;

int binpow(int a,int n,int M) {
    if (n==0)
        return 1;
    if (n%2!=0)
        return (a * binpow(a,n-1,M))%M;
    int z=binpow(a,n/2,M);
    return (z*z)%M;
}

const ll INF = 1e18+7;
const int N = 5e3+7;
const int M = 1e4+7;
const ld eps = 1e-3;

int n;
vector <int> v;

int check(int i,bool b) {
    vector <int> d;
    if (!b)
        d.pb(i+1);
    for (int j=1;j<=n;j++) {
        if (j==i+1)
            continue;
        d.pb(j);
    }
    d.pb(i+1);
    return publish(d);
}

void solve(int nn) {
    n=nn;
    for (int i=1;i<=n;i++)
        v.pb(i);
    int s=publish(v);
    vector <int> ans;
    for (int i=1;i<=n;i++) {
        int z,y,l=0;
        if (i<n) {
            z=check(i,true)-s;
            y=n-i;
            l+=(y-z)/2;
        }
        if (i>1) {
            z=s-check(i,false);
            y=i-1;
            l+=(y-z)/2;
        }
        ans.pb(l+1);
    }
    answer(ans);
}   

/*
signed main() {
    //file("jenga");
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    int test = 1;
    // cin >> test;
    while (test--) {
        solve();
        if (test)
            cout << '\n';
    }
    return 0;
}
*/

Compilation message (stderr)

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...