Submission #1080199

# Submission time Handle Problem Language Result Execution time Memory
1080199 2024-08-29T07:57:10 Z KhoaDuy Library (JOI18_library) C++14
Compilation error
0 ms 0 KB
#include <cstdio>
#include <vector>
#include "library.h"
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#define endl '\n'
void Solve(int n){
    vector<int> m(n,0);
    m[0]=1;
    int input=Query(m);
    /*vector<vector<int>> inter;
    vector<int> m(n,0);
    int input;
    for(int i=0;i<n;i++){
        m[i]=1;
        input=Query(m);
        if(input!=i+1){
            break;
        }
        inter.push_back(i);
    }*/
    /*for(int k=inter.size();k<n;k++){
        int low=0,high=inter.size()-1;
        low--,high++;
        while(high-low>1){
            int mid=((high-low)>>1)+low;
            fill(m.begin(),m.end(),0);
            m[k]=1;
            for(int i=0;i<=mid;i++){
                for(int x:inter[i]){
                    m[x]=1;
                }
            }
            input=Query(m);
            if(input<mid+2){
                high=mid;
            }
            else{
                low=mid;
            }
        }
        if(high==inter.size()){
            inter.push_back(k);
            continue;
        }
        fill(m.begin(),m.end(),0);
        m[k]=1,m[inter[high][0]]=1;
        input=Query(m);
        if(input==1){
            inter[high].insert(inter[high].begin(),k);
        }
        else{
            inter[high].push_back(k);
        }
        int l=high;
        if(l<inter.size()-1){
            low=l+1,high=inter.size()-1;
            low--,high++;
            while(high-low>1){
                int mid=((high-low)>>1)+low;
                fill(m.begin(),m.end(),0);
                m[k]=1;
                for(int i=l+1;i<=mid;i++){
                    for(int x:inter[i]){
                        m[x]=1;
                    }
                }
                input=Query(m);
                if(input<mid-l+1){
                    high=mid;
                }
                else{
                    low=mid;
                }
            }
            if(high<inter.size()){
                fill(m.begin(),m.end(),0);
                m[k]=1;
                m[inter[high][0]]=1;
                input=Query(m);
                if(inter[l][0]==k){
                    vector<int> temp;
                    if(input==1){

                    }
                    else{
                        for(int x:inter[high]){
                            temp.push_back(x);
                        }
                        for(int x:inter[l]){
                            temp.push_back(x);
                        }
                        inter[high]=temp;
                        auto it=inter.begin()+l;
                        inter.erase(it);
                    }
                }
                else{
                    if(input==1){

                    }
                    else{

                    }
                }
            }
        }
    }*/
}

Compilation message

library.cpp: In function 'void Solve(long long int)':
library.cpp:11:21: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   11 |     int input=Query(m);
      |                     ^
In file included from library.cpp:3:
library.h:2:35: note: in passing argument 1 of 'int Query(const std::vector<int>&)'
    2 | int Query(const std::vector<int>& M);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~^
library.cpp:11:9: warning: unused variable 'input' [-Wunused-variable]
   11 |     int input=Query(m);
      |         ^~~~~