Submission #382849

#TimeUsernameProblemLanguageResultExecution timeMemory
382849aris12345678Exam (eJOI20_exam)C++14
12 / 100
32 ms3180 KiB
#include <bits/stdc++.h> using namespace std; const int mxN = 1e6+5; int a[mxN], b[mxN]; int main() { int n; scanf("%d", &n); for(int i = 0; i < n; i++) scanf("%d", &a[i]); for(int i = 0; i < n; i++) scanf("%d", &b[i]); int i = 0, j = 0, mx = 0, ans = 0; while(j < n) { if(a[j] > b[0] && mx == b[0]) ans += (j-i), mx = 0; while(a[j] > b[0]) j++, i = j; mx = max(mx, a[j++]); } if(mx == b[0]) ans += (j-i); printf("%d\n", ans); return 0; }

Compilation message (stderr)

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