Submission #771921

#TimeUsernameProblemLanguageResultExecution timeMemory
771921BlockOGExam (eJOI20_exam)C++14
0 / 100
2 ms340 KiB
#include <iostream> using namespace std; /* 3 1 2 3 2 2 2 4 10 1 9 1 10 9 10 9 */ int main() { int n; cin >> n; int a[n], b[n]; for (int i = 0; i < n; i++) cin >> a[i]; cin >> b[0]; for (int i = 1; i < n; i++) { cin >> b[i]; if (b[i] != b[i - 1]) return 0; } int res = 0; int i = 0, ma = 0, j = 0; for (; i < n; i++) { if (a[i] > b[0]) { if (ma == b[0]) res += i - j; j = i + 1; ma = 0; } ma = max(ma, a[i]); } if (ma == b[0]) res += i - j; cout << res << endl; }
#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...