답안 #742197

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
742197 2023-05-15T18:27:09 Z sword060 Volontiranje (COCI21_volontiranje) C++17
50 / 110
1000 ms 4848 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int x,a[N],dp[N];
bool vis[N];
int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	cin>>x;
	for(int i=1;i<=x;i++)cin>>a[i];
	vector<vector<int>>v;
	int mx=-1;
	for(int p=1;p<=x;p++){
		int cur=0;
		for(int j=1;j<=x;j++){
			if(vis[j])continue;
			dp[j]=1;
			for(int i=1;i<j;i++){
				if(vis[i])continue;
				if(a[i]<a[j])
				  dp[j]=max(dp[i]+1,dp[j]);
			}
			cur=max(cur,dp[j]);
		}
		if(mx>cur)break;
		mx=cur;
		vector<int>nw;
		for(int i=x;i>=1;i--){
			if(!vis[i]&&dp[i]==cur){
				cur--;
				nw.push_back(i);
				vis[i]=1;
			}
		}
		reverse(nw.begin(),nw.end());
		v.push_back(nw);
	}
	cout<<v.size()<<" "<<mx<<"\n";
	for(auto i:v){
		for(auto j:i)
			cout<<j<<" ";
		cout<<"\n";
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 324 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 324 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 4 ms 340 KB Output is correct
28 Correct 1 ms 324 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 203 ms 360 KB Output is correct
31 Correct 7 ms 356 KB Output is correct
32 Correct 11 ms 340 KB Output is correct
33 Correct 92 ms 344 KB Output is correct
34 Correct 119 ms 356 KB Output is correct
35 Correct 100 ms 356 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
38 Correct 4 ms 340 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 340 KB Output is correct
45 Correct 1 ms 324 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 324 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 4 ms 340 KB Output is correct
28 Correct 1 ms 324 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 203 ms 360 KB Output is correct
31 Correct 7 ms 356 KB Output is correct
32 Correct 11 ms 340 KB Output is correct
33 Correct 92 ms 344 KB Output is correct
34 Correct 119 ms 356 KB Output is correct
35 Correct 100 ms 356 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
38 Correct 4 ms 340 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 340 KB Output is correct
45 Correct 1 ms 324 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Execution timed out 1063 ms 4848 KB Time limit exceeded
48 Halted 0 ms 0 KB -