Submission #77232

#TimeUsernameProblemLanguageResultExecution timeMemory
77232farukkastamonudaUntitled (POI11_tem)C++14
48 / 100
324 ms33792 KiB
#include <bits/stdc++.h> using namespace std; int n,s[1000000],e[1000000],x[1000000],v[1000000],mn,c[1000000],ans,ds,de; int main(){ scanf("%d", &n); for(int i=0; i<n; i++){ scanf("%d%d", s+i, e+i); } ds=de=n; for(int i=0;i<n;i++){ int cmn=i; while(ds < de && s[x[ds]] < s[i]){ cmn = min(cmn,v[x[ds]]); c[v[x[ds]]] = 0; ds++; } c[cmn]=1; while(ds < de && s[x[de - 1]] > e[i]){ de--; c[v[x[de]]] = 0; while(!c[mn]) mn++; } x[--ds] = i; v[i] = cmn; ans = max(ans,i - mn + 1); } printf("%d\n", ans); return 0; }

Compilation message (stderr)

tem.cpp: In function 'int main()':
tem.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
tem.cpp:9:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", s+i, e+i);
         ~~~~~^~~~~~~~~~~~~~~~~~
#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...