Submission #492442

#TimeUsernameProblemLanguageResultExecution timeMemory
492442aris12345678Untitled (POI11_tem)C++14
0 / 100
223 ms30624 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; #define X first #define Y second const int mxN = 1000005; int x[mxN], y[mxN]; int main() { int n; scanf("%d", &n); stack<pii> st; int ans = 0; for(int i = 0; i < n; i++) { scanf("%d %d", &x[i], &y[i]); if(st.empty()) st.push({x[i], y[i]}); else if(st.top().X <= y[i]) st.push({x[i], y[i]}); else { ans = max(ans, int(st.size())); while(!st.empty()) st.pop(); st.push({x[i], y[i]}); } } ans = max(ans, int(st.size())); printf("%d\n", ans); return 0; }

Compilation message (stderr)

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