Submission #1031504

#TimeUsernameProblemLanguageResultExecution timeMemory
1031504hasan2006Art Collections (BOI22_art)C++17
100 / 100
899 ms2312 KiB
#include <bits/stdc++.h>
#include "art.h"
using namespace std;

#define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define rall(s) s.rbegin(),s.rend()
#define all(s) s.begin(),s.end()
#define pb push_back
#define se second
#define fi first
#define ll long long
#define ld long double
#define YES cout<<"YES\n"
#define Yes cout<<"Yes\n"
#define yes cout<<"yes\n"
#define NO cout<<"NO\n"
#define No cout<<"No\n"
#define no cout<<"no\n"


const int N = 5e5 + 9 , mod = 1e9 + 7;
ll a[N] , b[N] , dp[N] , c[N] , d[N] ;


void solve(int n)
{
    ll q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
    vector<int>v , vc(n);
    set<int>st;
    for(i = 1; i <= n; i++){
        v.pb(i);
        st.insert(i);
    }
    x = publish(v);
    for(i = 1; i < n; i++){
        vector<int>v1;
        for(j = 1; j < v.size(); j++)
            v1.pb(v[j]);
        v1.pb(v[0]);
        y = publish(v1);
        k = -((y - x - 1 - n) / 2);
        st.erase(k);
        vc[k - 1] = i;
        x = y;
        v = v1;
    }
    vc[*st.begin() - 1] = n;
    answer(vc);
}

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:37:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         for(j = 1; j < v.size(); j++)
      |                    ~~^~~~~~~~~~
art.cpp:27:8: warning: unused variable 'q' [-Wunused-variable]
   27 |     ll q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |        ^
art.cpp:27:19: warning: unused variable 'l' [-Wunused-variable]
   27 |     ll q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                   ^
art.cpp:27:22: warning: unused variable 'r' [-Wunused-variable]
   27 |     ll q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                      ^
art.cpp:27:34: warning: unused variable 's' [-Wunused-variable]
   27 |     ll q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                  ^
art.cpp:27:42: warning: unused variable 'f' [-Wunused-variable]
   27 |     ll q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                          ^
art.cpp:27:50: warning: unused variable 'm' [-Wunused-variable]
   27 |     ll q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                                  ^
art.cpp:27:54: warning: unused variable 'mn' [-Wunused-variable]
   27 |     ll q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                                      ^~
art.cpp:27:65: warning: unused variable 'mx' [-Wunused-variable]
   27 |     ll q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                                                 ^~
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...