#include <iostream>
#include <algorithm>
#include <random>
#include <climits>
#include <utility>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <fstream>
#include "floppy.h"
#define ll long long
// #define int ll
#define endl '\n'
#define pb push_back
#define f first
#define s second
#define fo(i, a, b) for (auto i = (a); i < (b); i++)
#define of(i, a, b) for (auto i = (b); i-- > (a);)
#define lb lower_bound
#define ub upper_bound
#define be(a) a.begin(), a.end()
#define MAX INT_MAX
#define LMAX LONG_LONG_MAX
#define MIN INT_MIN
#define LMIN LONG_LONG_MIN
using namespace std;
int init_____ = []{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
return 0;
}();
template<typename T> bool mis(T &a, const T &b) { return b < a ? a = b, true : false; }
template<typename T> bool mas(T &a, const T &b) { return b > a ? a = b, true : false; }
template<typename T> bool mise(T &a, const T &b) { return b <= a ? a = b, true : false; }
template<typename T> bool mase(T &a, const T &b) { return b >= a ? a = b, true : false; }
template<typename T> bool gcd(const T &a, const T &b) { return a > b ? gcd(b, a) : (a == T(0) ? b : gcd(b % a, a)); }
template<typename T> bool lcm(const T &a, const T &b) { return a * b / gcd(a, b); }
// mt19937 rng(time(NULL));
// int rand(int a, int b) {
// return a + rng() % (b - a);
// }
// string floppy;
// void save_to_floppy(string &bits) {
// floppy = bits;
// }
// int32_t main() {
// int n; cin >> n;
// vector<int> v(n); fo(i, 0, n) cin >> v[i];
// }
pair<int, int> a[40000];
int b[40000];
int c[80000];
int d[80000];
void read_array(int subtask_id, const vector<int> &v) {
ofstream out("asdsdassdsad");
fo(i, 0, v.size()) out << v[i] << ' ';
// int n = v.size();
// fo(i, 0, n) a[i] = { v[i], i };
// sort(a, a + n);
// fo(i, 0, n) b[a[i].s] = i;
// string res;
// fo(i, 0, n) {
// int k = 1 << 13;
// fo(j, 0, 14) {
// if (b[i] & k) res += '1';
// else res += '0';
// k >>= 1;
// }
// }
// save_to_floppy(res);
save_to_floppy("0");
}
pair<int, int> get_max(int i, int cl, int cr, int l, int r) {
if (l <= cl && cr <= r) return { c[i], d[i] };
int mid = (cl + cr) / 2;
pair<int, int> res = { INT_MIN, 0 };
if (cl < r || l < mid) {
pair<int, int> asd = get_max(i * 2, cl, mid, l, r);
if (asd.f > res.f) res = asd;
}
if (mid < r || l < cr) {
pair<int, int> asd = get_max(i * 2 + 1, mid, cr, l, r);
if (asd.f > res.f) res = asd;
}
return res;
}
vector<int> solve_queries(int subtask_id, int n, const string &bits, const vector<int> &a, const vector<int> &b) {
ifstream in("asdsdassdsad");
fo(i, 0, n) {
in >> c[i + n];
d[i + n] = i;
}
of(i, 1, n) {
if (c[i * 2] >= c[i * 2 + 1]) {
c[i] = c[i * 2];
d[i] = d[i * 2];
} else {
c[i] = c[i * 2 + 1];
d[i] = d[i * 2 + 1];
}
}
vector<int> res;
fo(i, 0, a.size()) {
res.pb(get_max(1, a[i], b[i] + 1).s);
}
return res;
}
Compilation message
floppy.cpp: In function 'void read_array(int, const std::vector<int>&)':
floppy.cpp:19:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
19 | #define fo(i, a, b) for (auto i = (a); i < (b); i++)
| ^
floppy.cpp:68:5: note: in expansion of macro 'fo'
68 | fo(i, 0, v.size()) out << v[i] << ' ';
| ^~
floppy.cpp: In function 'std::vector<int> solve_queries(int, int, const string&, const std::vector<int>&, const std::vector<int>&)':
floppy.cpp:19:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
19 | #define fo(i, a, b) for (auto i = (a); i < (b); i++)
| ^
floppy.cpp:124:5: note: in expansion of macro 'fo'
124 | fo(i, 0, a.size()) {
| ^~
floppy.cpp:125:41: error: too few arguments to function 'std::pair<int, int> get_max(int, int, int, int, int)'
125 | res.pb(get_max(1, a[i], b[i] + 1).s);
| ^
floppy.cpp:89:16: note: declared here
89 | pair<int, int> get_max(int i, int cl, int cr, int l, int r) {
| ^~~~~~~
stub.cpp: In function 'void run2()':
stub.cpp:101:30: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
101 | if (query_answers.size() != M) {
| ~~~~~~~~~~~~~~~~~~~~~^~~~