답안 #1078282

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1078282 2024-08-27T14:48:43 Z Maite_Morale 9월 (APIO24_september) C++17
100 / 100
474 ms 18112 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vll vector<ll>
#define MAX 500005
#define oo 10000000000
int solve(int N, int M, std::vector<int> F, std::vector<std::vector<int>> S) {
	vll a(N-1,0),mn(N,oo),mx(N,0);
	for(int i=0;i<N-1;i++)a[i]=i;
	for(int i=0;i<M;i++){
		map<ll,ll> mp;
		for(int j=0;j<N-1;j++){
			mp[S[i][j]]=j;
			mn[S[i][j]]=min(mn[S[i][j]],(ll)j);
			mx[S[i][j]]=max(mx[S[i][j]],(ll)j);
		}
		for(int j=0;j<N-1;j++){
			if(F[S[i][j]]!=0)a[mp[F[S[i][j]]]]=max(a[mp[F[S[i][j]]]],(ll)j);
		}
	}
	for(int j=1;j<N;j++){
		a[mn[j]]=max(a[mn[j]],mx[j]);
	}
	ll K=0,limit=0;
	for(int i=0;i<N-1;i++){
		//cout<<a[i]<<" ";
		limit=max(limit,a[i]);
		if(limit==i)K++;
	}
return K;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 3 ms 604 KB Output is correct
26 Correct 2 ms 604 KB Output is correct
27 Correct 2 ms 600 KB Output is correct
28 Correct 2 ms 604 KB Output is correct
29 Correct 2 ms 604 KB Output is correct
30 Correct 3 ms 604 KB Output is correct
31 Correct 3 ms 604 KB Output is correct
32 Correct 3 ms 604 KB Output is correct
33 Correct 2 ms 640 KB Output is correct
34 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 227 ms 17576 KB Output is correct
5 Correct 236 ms 17528 KB Output is correct
6 Correct 222 ms 17524 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 227 ms 17576 KB Output is correct
19 Correct 236 ms 17528 KB Output is correct
20 Correct 222 ms 17524 KB Output is correct
21 Correct 430 ms 17416 KB Output is correct
22 Correct 438 ms 17488 KB Output is correct
23 Correct 439 ms 17516 KB Output is correct
24 Correct 474 ms 17552 KB Output is correct
25 Correct 430 ms 17512 KB Output is correct
26 Correct 432 ms 17336 KB Output is correct
27 Correct 434 ms 17476 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 227 ms 17576 KB Output is correct
8 Correct 236 ms 17528 KB Output is correct
9 Correct 222 ms 17524 KB Output is correct
10 Correct 169 ms 17864 KB Output is correct
11 Correct 171 ms 17916 KB Output is correct
12 Correct 174 ms 17904 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 3 ms 604 KB Output is correct
26 Correct 2 ms 604 KB Output is correct
27 Correct 2 ms 600 KB Output is correct
28 Correct 2 ms 604 KB Output is correct
29 Correct 2 ms 604 KB Output is correct
30 Correct 3 ms 604 KB Output is correct
31 Correct 3 ms 604 KB Output is correct
32 Correct 3 ms 604 KB Output is correct
33 Correct 2 ms 640 KB Output is correct
34 Correct 2 ms 604 KB Output is correct
35 Correct 227 ms 17576 KB Output is correct
36 Correct 236 ms 17528 KB Output is correct
37 Correct 222 ms 17524 KB Output is correct
38 Correct 430 ms 17416 KB Output is correct
39 Correct 438 ms 17488 KB Output is correct
40 Correct 439 ms 17516 KB Output is correct
41 Correct 474 ms 17552 KB Output is correct
42 Correct 430 ms 17512 KB Output is correct
43 Correct 432 ms 17336 KB Output is correct
44 Correct 434 ms 17476 KB Output is correct
45 Correct 169 ms 17864 KB Output is correct
46 Correct 171 ms 17916 KB Output is correct
47 Correct 174 ms 17904 KB Output is correct
48 Correct 400 ms 17984 KB Output is correct
49 Correct 380 ms 17864 KB Output is correct
50 Correct 396 ms 18068 KB Output is correct
51 Correct 394 ms 18112 KB Output is correct
52 Correct 388 ms 17980 KB Output is correct
53 Correct 392 ms 17764 KB Output is correct
54 Correct 377 ms 17920 KB Output is correct