Submission #681794

#TimeUsernameProblemLanguageResultExecution timeMemory
681794kthngUntitled (POI11_tem)C++17
0 / 100
217 ms26948 KiB
#include<iostream> #include<deque> using namespace std; int a[1000000][2], n; deque<int> dq; int main() { scanf("%d", &n); int ret = 1; for (int i = 0; i < n; i++) scanf("%d%d", &a[i][0], &a[i][1]); for (int i = 0; i < n; i++) { if (i && a[i - 1][0] > a[i][1]) dq.clear(); if (!dq.empty() && a[i][1] < a[dq.front()][0]) dq.pop_front(); if (!dq.empty()) ret = max(ret, i - dq.front() + 1); if (!dq.empty() && a[i][0] < a[dq.back()][0]) dq.pop_back(); dq.push_back(i); } printf("%d\n", ret); return 0; }

Compilation message (stderr)

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