답안 #464305

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
464305 2021-08-12T20:22:43 Z AdamGS Exam (eJOI20_exam) C++14
43 / 100
1000 ms 98304 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=5007;
int a[LIM], b[LIM], dp[LIM][LIM];
int ma(int l, int r) {
	int ans=0;
	while(l<=r) {
		ans=max(ans, a[l]);
		++l;
	}
	return ans;
}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n;
	cin >> n;
	rep(i, n) cin >> a[i+1];
	rep(i, n) cin >> b[i+1];
	rep(i, n) rep(j, n) {
		dp[i+1][j+1]=max(dp[i+1][j], dp[i][j+1]);
		if(a[i+1]==b[j+1] && ma(min(i+1, j+1), max(i+1, j+1))==a[i+1]) {
			dp[i+1][j+1]=max(dp[i+1][j+1], dp[i+1][j]+1);
		}
	}
	cout << dp[n][n] << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 8268 KB Output is correct
2 Runtime error 6 ms 460 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 3 ms 3276 KB Output is correct
3 Correct 28 ms 24044 KB Output is correct
4 Correct 141 ms 94408 KB Output is correct
5 Correct 143 ms 98304 KB Output is correct
6 Correct 142 ms 98264 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 148 ms 98224 KB Output is correct
2 Runtime error 6 ms 408 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 700 KB Output is correct
10 Correct 2 ms 1228 KB Output is correct
11 Correct 2 ms 1228 KB Output is correct
12 Correct 1 ms 1228 KB Output is correct
13 Correct 1 ms 1228 KB Output is correct
14 Correct 1 ms 1228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 3 ms 3276 KB Output is correct
9 Correct 28 ms 24044 KB Output is correct
10 Correct 141 ms 94408 KB Output is correct
11 Correct 143 ms 98304 KB Output is correct
12 Correct 142 ms 98264 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 460 KB Output is correct
15 Correct 1 ms 700 KB Output is correct
16 Correct 2 ms 1228 KB Output is correct
17 Correct 2 ms 1228 KB Output is correct
18 Correct 1 ms 1228 KB Output is correct
19 Correct 1 ms 1228 KB Output is correct
20 Correct 1 ms 1228 KB Output is correct
21 Correct 1 ms 1228 KB Output is correct
22 Correct 9 ms 8268 KB Output is correct
23 Execution timed out 1098 ms 1924 KB Time limit exceeded
24 Halted 0 ms 0 KB -