Submission #83614

# Submission time Handle Problem Language Result Execution time Memory
83614 2018-11-09T13:39:39 Z nikolapesic2802 Temperature (POI11_tem) C++14
24 / 100
621 ms 33792 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back

int main()
{
    int n;
    scanf("%i",&n);
    vector<int> lo(n),hi(n);
    for(int i=0;i<n;i++)
        scanf("%i %i",&lo[i],&hi[i]);
    int last;
    multiset<int,greater<int> > mins;
    int res=1;
    int s=0;
    int sl=0;
    mins.insert(lo[0]);
    last=hi[0];
    for(int i=1;i<n;i++)
    {
        if(lo[i]>last)
        {
            mins.clear();
            mins.insert(lo[i]);
            last=hi[i];
            s=i;
            sl=i;
            continue;
        }
        if(*mins.begin()>hi[i])
        {
            mins.erase(mins.find(lo[sl]));
            sl++;
            s=sl;
        }
        while(mins.size()&&*mins.begin()>hi[i])
        {
            mins.erase(mins.find(lo[s]));
            s++;
            sl++;
        }
        if(lo[i]>=*mins.begin())
        {
            mins.clear();
            sl=i;
        }
        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:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i",&n);
     ~~~~~^~~~~~~~~
tem.cpp:14: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]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 616 KB Output is correct
2 Correct 2 ms 616 KB Output is correct
3 Correct 2 ms 616 KB Output is correct
4 Correct 2 ms 616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 764 KB Output is correct
2 Correct 6 ms 888 KB Output is correct
3 Correct 7 ms 1440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 121 ms 7800 KB Output is correct
2 Correct 148 ms 11576 KB Output is correct
3 Runtime error 439 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
# Verdict Execution time Memory Grader output
1 Runtime error 257 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 362 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 381 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 621 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 423 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 197 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 306 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 297 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -