Submission #839798

#TimeUsernameProblemLanguageResultExecution timeMemory
839798tshabanov7Exam (eJOI20_exam)C++17
12 / 100
19 ms3156 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } bool subtask2 = true; for (int i = 0; i < n; i++) { subtask2 &= b[i] == b[0]; } if (subtask2) { int ans = 0; for (int i = 0; i < n; i++) { if (a[i] > b[0]) { continue; } bool ok = false; int j = i; while (j < n && a[j] <= b[0]) { ok |= a[j] == b[0]; j++; } if (ok) { ans += j - i; } i = j - 1; } cout << ans << '\n'; } return 0; }
#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...