Submission #464922

#TimeUsernameProblemLanguageResultExecution timeMemory
464922gagik_2007Exam (eJOI20_exam)C++17
0 / 100
6 ms972 KiB
#include <iostream> #include <cmath> #include <algorithm> #include <vector> #include <string> #include <set> #include <map> #include <queue> #include <deque> #include <stack> #include <iomanip> #include <unordered_set> using namespace std; #define ll long long #define ff first #define ss second ll n, k, sum, m, s, f; ll MOD = 1e9 + 7; ll INF = 1e18 + 7; ll ttt; ll a[200007]; ll b[200007]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); 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, cnt = 0, cur = 0; bool p = false, q = false; for (int i = 0; i < n; i++) { if (a[i] < b[0]) { if (p) { cnt++; } cur++; } else if (a[i] == b[0]) { cnt = ++cur; p = true; } else { ans += cnt; cnt = 0, cur = 0; p = false; } } cout << ans << endl; return 0; }

Compilation message (stderr)

exam.cpp: In function 'int main()':
exam.cpp:38:18: warning: unused variable 'q' [-Wunused-variable]
   38 |  bool p = false, q = false;
      |                  ^
#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...