# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
13152 | woqja125 | Trading (IZhO13_trading) | C++98 | 308 ms | 16344 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<stdio.h>
#include<algorithm>
struct sales
{
int l, r, x;
bool operator<(const sales &A) const {return x<A.x;}
} dat[300001];
struct node
{
node *l, *r;
int x;
node(){l=r=NULL; x=0;}
void addRange(int s, int e, int f, int r, int x);
int getx(int s, int e, int l);
};
int main()
{
int n, m;
int i;
scanf("%d%d", &n, &m);
for(i=1; i<=m; i++)
{
scanf("%d%d%d", &dat[i].l, &dat[i].r, &dat[i].x);
dat[i].x -= dat[i].l;
}
std::sort(dat+1, dat+1+m);
node *ST = new node();
for(i=1; i<=m; i++)
{
ST->addRange(1, n, dat[i].l, dat[i].r, i);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |