Submission #464923

# Submission time Handle Problem Language Result Execution time Memory
464923 2021-08-14T13:11:10 Z gagik_2007 Exam (eJOI20_exam) C++17
12 / 100
32 ms 3880 KB
#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 + cnt << endl;
	return 0;
}

Compilation message

exam.cpp: In function 'int main()':
exam.cpp:38:18: warning: unused variable 'q' [-Wunused-variable]
   38 |  bool p = false, q = false;
      |                  ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 5 ms 592 KB Output is correct
3 Correct 18 ms 2724 KB Output is correct
4 Correct 16 ms 2252 KB Output is correct
5 Correct 32 ms 3880 KB Output is correct
6 Correct 16 ms 2244 KB Output is correct
7 Correct 16 ms 2364 KB Output is correct
8 Correct 26 ms 3788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -