답안 #462317

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
462317 2021-08-10T11:13:55 Z bigo Exam (eJOI20_exam) C++14
12 / 100
89 ms 1348 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>vec;
	for (int i = 0; i < n; i++) {
		if (a[i] == b[0])
			vec.push_back(i);

	}
	int ans = 0;
	vector<bool>ok(n, false);
	for (int i = 0; i < vec.size(); i++) {
		if (!ok[vec[i]]) {
			for (int j = vec[i]; j >= 0; j--) {
				if (a[j] <= b[0])
					ok[j] = true;
				else
					break;
			}
			for (int j = vec[i]; j <n; j++) {
				if (a[j] <= b[0])
					ok[j] = true;
				else
					break;
			}
		}
	}
	for (int i = 0; i < n; i++)
		if (ok[i])
			ans++;
	cout << ans;
}

Compilation message

exam.cpp: In function 'int main()':
exam.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for (int i = 0; i < vec.size(); i++) {
      |                  ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 21 ms 448 KB Output is correct
3 Correct 57 ms 996 KB Output is correct
4 Correct 38 ms 1080 KB Output is correct
5 Correct 89 ms 1064 KB Output is correct
6 Correct 40 ms 1348 KB Output is correct
7 Correct 46 ms 1064 KB Output is correct
8 Correct 86 ms 1076 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -