Submission #994859

#TimeUsernameProblemLanguageResultExecution timeMemory
994859lollipopLibrary (JOI18_library)C++17
Compilation error
0 ms0 KiB
#include "library.h" #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define int long long #define pb push_back #define s second #define f first #define pf push_front #define inf 100000000000000000 #define bitebi __builtin_popcountll #define FOR( i , n ) for( int i = 0 ; i < n ; i ++ ) #define YES cout <<"YES\n" #define NO cout << "NO\n" #define debug cout << "Here Fine" << endl ; #define pr pair < int , int > #define fbo find_by_order // returns iterator #define ook order_of_key // returns strictly less numbers than key using namespace std ; //#pragma GCC optimize("Ofast") //#pragma GCC target("avx,avx2,fma") using namespace __gnu_pbds; using namespace __gnu_cxx; template<class T> using ordered_set =tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update> ; const double Pi=acos(-1.0); const double EPS=1E-8; const int mod = 1000000007 ; const int mod1 = 998244353 ; const int N = 2e5 + 10 ; mt19937 R(time(0)); map < int , int > ma , ma1 ; // int Query( vector ) // void Answer ( vector ) void solve( int n ){ vector < int > ans , lf ; for( int i = 2 ; i <= n ; i ++ ) lf.pb( i ) ; ans.pb( 1 ) ; vector < int > cur ; while( true ){ if( ans.size() == n ) break ; int l = 0 , r = lf.size() - 1 ; while( l < r ){ int mid = ( l + r ) / 2 ; cur.clear() ; // will left be good? for( int j = 0 ; j <= mid ; j ++ ) cur.pb( lf[ j ] ) ; int nmb ; nmb = Query( cur ) ; for( auto x : ans ) cur.pb( x ) ; int nmb1 ; nmb1 = Query( cur ) ; if( nmb1 == nmb ){ r = mid ; continue ; } else{ l = mid + 1 ; continue ; } } // gipovia mezobeli -- l -- shia int node = lf[ l ] ; lf.erase( lf.begin() + l ) ; int nmb ; nmb = Query( { node , ans[ 0 ] } ) ; if( nmb == 2 ){ ans.pb( node ) ; } else ans.insert( ans.begin() , node ) ; } Answer( ans ) ; } //signed main() { // ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL); // int t = 1 ; // cin >> t ; // while( t -- ){ // solve() ; // } // //}

Compilation message (stderr)

library.cpp: In function 'void solve(long long int)':
library.cpp:48:21: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   48 |      if( ans.size() == n ) break ;
      |          ~~~~~~~~~~~^~~~
library.cpp:57:21: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   57 |        nmb = Query( cur ) ;
      |                     ^~~
In file included from library.cpp:1:
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:60:22: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   60 |        nmb1 = Query( cur ) ;
      |                      ^~~
In file included from library.cpp:1:
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:72:22: warning: narrowing conversion of 'node' from 'long long int' to 'int' [-Wnarrowing]
   72 |       nmb = Query( { node , ans[ 0 ] } ) ;
      |                      ^~~~
library.cpp:72:22: warning: narrowing conversion of 'node' from 'long long int' to 'int' [-Wnarrowing]
library.cpp:72:40: warning: narrowing conversion of 'ans.std::vector<long long int>::operator[](0)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
   72 |       nmb = Query( { node , ans[ 0 ] } ) ;
      |                                        ^
library.cpp:72:40: warning: narrowing conversion of 'ans.std::vector<long long int>::operator[](0)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
library.cpp:79:11: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   79 |   Answer( ans ) ;
      |           ^~~
In file included from library.cpp:1:
library.h:3:37: note: in passing argument 1 of 'void Answer(const std::vector<int>&)'
    3 | void Answer(const std::vector<int>& res);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^~~