Submission #83631

#TimeUsernameProblemLanguageResultExecution timeMemory
83631nikolapesic2802Untitled (POI11_tem)C++14
0 / 100
1033 ms33792 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back int main() { int n; scanf("%i",&n); int lo,hi; scanf("%i %i",&lo,&hi); int last; multiset<int,greater<int> > mins; queue<pair<int,int> > dodati; int res=1; int s=0; mins.insert(lo); dodati.push({lo,0}); for(int i=1;i<n;i++) { scanf("%i %i",&lo,&hi); while(mins.size()&&*mins.begin()>hi) { mins.erase((dodati.front()).first); s=(dodati.front()).second+1; dodati.pop(); } mins.insert(lo); dodati.push({lo,i}); res=max(res,i-s+1); } printf("%i\n",res); return 0; }

Compilation message (stderr)

tem.cpp: In function 'int main()':
tem.cpp:14:9: warning: unused variable 'last' [-Wunused-variable]
     int last;
         ^~~~
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:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i %i",&lo,&hi);
     ~~~~~^~~~~~~~~~~~~~~~~
tem.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%i %i",&lo,&hi);
         ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...