Submission #83643

# Submission time Handle Problem Language Result Execution time Memory
83643 2018-11-09T14:29:08 Z nikolapesic2802 Temperature (POI11_tem) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back

const int N=1e6+5;
vector<int> lo(N),hi(N);


int main()
{
    int n;
    scanf("%i",&n);
    for(int i=0;i<n;i++)
        scanf("%i %i",&lo[i],&hi[i]);
    int r=res;
    multiset<int,greater<int> > mins;
    res=1;
    int s=0;
    mins.insert(lo[0]);
    for(int i=1;i<n;i++)
    {
        while(mins.size()&&*mins.begin()>hi[i])
        {
            mins.erase(mins.find(lo[s]));
            s++;
        }
        mins.insert(lo[i]);
        res=max(res,i-s+1);
    }
    printf("%i\n",res);
 
    return 0;
}

Compilation message

tem.cpp: In function 'int main()':
tem.cpp:18:11: error: 'res' was not declared in this scope
     int r=res;
           ^~~
tem.cpp:18:9: warning: unused variable 'r' [-Wunused-variable]
     int r=res;
         ^
tem.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i",&n);
     ~~~~~^~~~~~~~~
tem.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%i %i",&lo[i],&hi[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~