Submission #881501

# Submission time Handle Problem Language Result Execution time Memory
881501 2023-12-01T10:10:35 Z StefanSebez Fire (JOI20_ho_t5) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
const int N=2*1e5+50;
int lc[2*N],rc[2*N],root,nc,sum[2*N],lazy1[2*N],lazy2[2*N];
void Update1(int &c,int ss,int se,int qs,int qe)
{

}
int main()
{
    int n,q;scanf("%i%i",&n,&q);
    int a[n+1];for(int i=1;i<=n;i++) scanf("%i",&a[i]);
    int L[n+1]={0},R[n+1];
    vector<int>mono;
    for(int i=1;i<=n;i++)
    {
        R[i]=n+1;
        while(mono.size() && a[mono.back()]<=a[i])
        {
            R[mono.back()]=i;
            mono.pop_back();
        }
        if(mono.size()) L[i]=mono.back();
        mono.pb(i);
    }
    //for(int i=1;i<=n;i++) printf("%i %i\n",L[i],R[i]);
    vector<pair<int,pair<int,int> > >query;
    while(q--)
    {
        int t,l,r;scanf("%i%i%i",&t,&l,&r);
        query.pb({l,{t,0}});
        query.pb({r,{t,1}});
    }
    sort(query.begin(),query.end());
    for(int i=1,j=0;i<=n;i++)
    {
        while(j<query.size() && query[j].fi==i)
        {
            update 0,1,...,i-L[i]-1
            j++;
        }
    }
    return 0;
}

Compilation message

ho_t5.cpp: In function 'int main()':
ho_t5.cpp:40:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         while(j<query.size() && query[j].fi==i)
      |               ~^~~~~~~~~~~~~
ho_t5.cpp:42:13: error: 'update' was not declared in this scope; did you mean 'Update1'?
   42 |             update 0,1,...,i-L[i]-1
      |             ^~~~~~
      |             Update1
ho_t5.cpp:14:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     int n,q;scanf("%i%i",&n,&q);
      |             ~~~~~^~~~~~~~~~~~~~
ho_t5.cpp:15:43: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     int a[n+1];for(int i=1;i<=n;i++) scanf("%i",&a[i]);
      |                                      ~~~~~^~~~~~~~~~~~
ho_t5.cpp:33:24: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         int t,l,r;scanf("%i%i%i",&t,&l,&r);
      |                   ~~~~~^~~~~~~~~~~~~~~~~~~