Submission #1017965

#TimeUsernameProblemLanguageResultExecution timeMemory
1017965davit_tsibadzeLibrary (JOI18_library)C++17
Compilation error
0 ms0 KiB
#include <library.h> using namespace std; #define ff first #define sc second #define pb push_back #define ll long long #define pll pair<ll, ll> #define pii pair<int, int> const ll inf = 1e18; #define int long long vector <int> ans, m; void Solve(int N){ int d; while(m.size() < N)m.pb(1); for (int i = 1; i <= N; i++){ m[i - 1] = 0; if (Query(m) == 1){d = i; break;} } vector <int> a, ans; ans.pb(d); for (int i = 1; i <= n; i++) if (i != d)a.pb(i); while(a.size()){ int l = 0, r = a.size() - 1, mid; while(l < r){ mid = (l + r) / 2; for (int i = 0; i < m.size(); i++) m[i] = 0; for (int i = 0; i <= mid; i++) m[a[i] - 1] = 1; int x = Query(m); m[ans.back() - 1] = 1; int y = Query(m); if (x == y)r = mid; else l = mid + 1; } swap(a[l], a[a.size() - 1]); ans.pb(a.back()); a.pop_back(); } Answer(ans); }

Compilation message (stderr)

library.cpp: In function 'void Solve(long long int)':
library.cpp:16:20: 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]
   16 |     while(m.size() < N)m.pb(1);
      |           ~~~~~~~~~^~~
library.cpp:19:19: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   19 |         if (Query(m) == 1){d = i; break;}
      |                   ^
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:22:26: error: 'n' was not declared in this scope
   22 |     for (int i = 1; i <= n; i++) if (i != d)a.pb(i);
      |                          ^
library.cpp:27:31: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |             for (int i = 0; i < m.size(); i++)
      |                             ~~^~~~~~~~~~
library.cpp:31:27: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   31 |             int x = Query(m);
      |                           ^
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:33:27: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   33 |             int y = Query(m);
      |                           ^
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:40:12: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   40 |     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);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^~~