Submission #465677

#TimeUsernameProblemLanguageResultExecution timeMemory
465677Alen777Exam (eJOI20_exam)C++14
12 / 100
29 ms3800 KiB
#include <iostream> #include <string> #include <iomanip> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <cmath> #include <algorithm> #include <cstring> using namespace std; #define ll long long #define ull unsigned ll #define pb push_back #define mpr make_pair #define lb lower_bound #define ld long double #define ub upper_bound ll a[200005], b[200005]; int n; void solve() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } ll ans = 0, num = 0; ll s = 0; bool flag = false; for (int i = 0; i < n; i++) { if (a[i] < b[0]) { if (flag) { num++; } s++; } else if (a[i] == b[0]) { num = s+1; s++; flag = true; } else { ans += num; num = 0, s = 0; flag = false; } } cout << ans + num << endl; } int main() { /*cout.setf(ios::fixed | ios::showpoint); cout.precision(6);*/ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t = 1; //cin >> t; while (t--) { solve(); } 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...