Submission #462373

# Submission time Handle Problem Language Result Execution time Memory
462373 2021-08-10T12:37:05 Z bigo Exam (eJOI20_exam) C++14
0 / 100
9 ms 332 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int, int> pii;
int main() {
	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];
	}
	vector<int>ok(n, 0);
	for (int i = 0; i < n; i++) {
		if (a[i] > b[i])
			ok[i] = 2;
		else if (a[i] == b[i])
			ok[i] = 1;
	}
	for (int i = 0; i < n; i++) {
		if (ok[i]==0) {
			int pla = -1;
			for (int j = i + 1; j < n; j++) {
				if (a[j] == b[i]) {
					pla = j;
					break;
				}
			}
			if (pla == -1)
				ok[i] = 2;
			else {
				int tmp = 0;
				int tmp1 = 1;
				for (int j = i + 1; j <= pla; j++) {
					if (ok[j] == 1) {
						if (b[i] != b[j])
							tmp++;
					}
					if (b[i] == b[j])
						tmp1++;
				}
				if (tmp1 > tmp) {
					ok[i] = 1;
					for (int j = i + 1; j <= pla; j++) {
						if (ok[j] == 1) {
							if (b[i] != b[j])
								ok[i] = 2;
						}
						if (b[i] == b[j])
							ok[j] = 1;
					}
				}
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (ok[i] == 1)
			ans++;
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 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 9 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -