// #include "horses.h"
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007;
#define pb push_back
int n, x[500005], y[500005];
set<int, greater<int>> s;
struct node
{
long long val;
node *l, *r;
} *root1, *root2;
node* build1(int l,int r)
{
node *ptr = new node;
if(l == r)
{
ptr->val = x[l];
return ptr;
}
int mid = (l + r) / 2;
ptr->l = build1(l, mid);
ptr->r = build1(mid + 1, r);
ptr->val = ptr->l->val * ptr->r->val;
ptr->val %= mod;
return ptr;
}
node* build2(int l,int r)
{
node *ptr = new node;
if(l == r)
{
ptr->val = y[l];
return ptr;
}
int mid = (l + r) / 2;
ptr->l = build2(l, mid);
ptr->r = build2(mid + 1, r);
ptr->val = max(ptr->l->val, ptr->r->val);
return ptr;
}
int ll,rr;
long long que1(node *ptr, int l,int r)
{
if(ll <= l && r <= rr) return ptr->val;
if(r < ll || rr < l) return 1;
int mid = (l + r) / 2;
return (que1(ptr->l, l, mid) * que1(ptr->r, mid + 1, r)) % mod;
}
int que2(node *ptr, int l,int r)
{
if(ll <= l && r <= rr) return ptr->val;
if(r < ll || rr < l) return 0;
int mid = (l + r) / 2;
return max(que2(ptr->l, l, mid),que2(ptr->r, mid + 1, r));
}
int up_po,up_val;
void up1(node *ptr, int l,int r)
{
if(l == r)
{
ptr->val = up_val;
return ;
}
int mid = (l + r) / 2;
if(up_po <= mid) up1(ptr->l, l, mid);
else up1(ptr->r, mid + 1, r);
ptr->val = ptr->l->val * ptr->r->val;
ptr->val %= mod;
}
void up2(node *ptr, int l,int r)
{
if(l == r)
{
ptr->val = up_val;
return ;
}
int mid = (l + r) / 2;
if(up_po <= mid) up2(ptr->l, l, mid);
else up2(ptr->r, mid + 1, r);
ptr->val = max(ptr->l->val, ptr->r->val);
}
Compilation message
horses.cpp: In function 'int que2(node*, int, int)':
horses.cpp:59:40: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
59 | if(ll <= l && r <= rr) return ptr->val;
| ~~~~~^~~
/usr/bin/ld: /tmp/ccrwYyNe.o: in function `main':
grader.c:(.text.startup+0xaa): undefined reference to `init(int, int*, int*)'
/usr/bin/ld: grader.c:(.text.startup+0x113): undefined reference to `updateX(int, int)'
/usr/bin/ld: grader.c:(.text.startup+0x16d): undefined reference to `updateY(int, int)'
collect2: error: ld returned 1 exit status