Submission #83609

# Submission time Handle Problem Language Result Execution time Memory
83609 2018-11-09T13:31:27 Z nikolapesic2802 Temperature (POI11_tem) C++14
24 / 100
1000 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;
    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;
            continue;
        }
        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: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 3 ms 504 KB Output is correct
2 Correct 2 ms 768 KB Output is correct
3 Correct 2 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 768 KB Output is correct
2 Correct 2 ms 776 KB Output is correct
3 Correct 2 ms 792 KB Output is correct
4 Correct 2 ms 792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 852 KB Output is correct
2 Correct 7 ms 1556 KB Output is correct
3 Correct 7 ms 1556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 279 ms 24016 KB Output is correct
2 Runtime error 326 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.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 890 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 Execution timed out 1012 ms 33792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 787 ms 33792 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1042 ms 33792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 543 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 498 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 Execution timed out 1039 ms 33792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 938 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 -