제출 #1349772

#제출 시각아이디문제언어결과실행 시간메모리
1349772blameazuSeptember (APIO24_september)C++20
0 / 100
0 ms344 KiB
#include "september.h"

#include <bits/stdc++.h>
using namespace std;

int solve(int n, int m, vector<int> F, vector<vector<int> > S) {
	int ans = 0;
	vector<vector<int> > ok(m, vector<int> (n));
	for(int l = 0; l < m; l++) {
		vector<int> vis(n);
		int now = n-1;
		for(int i = 0; i < n-1;) {
			int j = i;
			while(j < n-1 && S[l][j] != now) {
				vis[S[l][j]] = 1;
				j++;
			}
			do {
				now--;
			} while(now >= 1 && vis[now]);
			i = j+1;
			ok[l][j] = 1;
		}
	}
	for(int i = 0; i < n-1; i++) {
		int OK = 1;
		for(int j = 0; j < m; j++) OK &= ok[j][i];
		if(OK) ans++;
	}
	return ans;
}

/*
1
5 1
0 1 2 3 
4 3 2 1

*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...