이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "september.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int solve(int N, int M, vector<int> P, vector<vector<int>> S) {
vector pos(M, vector<int>(N));
vector mx(M, vector<int>(N));
for (int i = 0; i < M; i++) {
for (int j = 0; j < N - 1; j++) {
pos[i][S[i][j]] = mx[i][S[i][j]] = j;
}
}
for (int i = 0; i < M; i++) {
for (int j = N - 1; j; j--) {
mx[i][P[j]] = max(mx[i][P[j]], pos[i][j]);
}
}
int ans = 0;
for (int i = 0, j = -1; i < N - 1; i++) {
for (int k = 0; k < M; k++) {
for (int t = 0; t < M; t++) {
j = max(j, mx[t][S[k][i]]);
}
}
if (j == i) ans++, j = -1;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |