이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "september.h"
#include <cstring>
#include <vector>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int N = 100000;
int gg[N], dd[N];
int solve(int n, int m, vi pp, vector<vi> iii) {
for (int g = 0; g < n - 1; g++)
gg[iii[0][g]] = g;
gg[0] = n - 1;
memset(dd, 0, n * sizeof *dd);
for (int h = 1; h < m; h++)
for (int g = 0; g < n - 1; g++) {
int g_ = gg[iii[h][g]];
if (g < g_)
dd[g]++, dd[g_]--;
else
dd[g_]++, dd[g]--;
}
for (int j = 1; j < n - 1; j++) {
int i = pp[j];
if (gg[i] < gg[j])
dd[gg[i]]++, dd[gg[j]]--;
}
for (int g = 1; g < n; g++)
dd[g] += dd[g - 1];
int cnt = 0;
for (int g = 0; g < n - 1; g++)
if (dd[g] == 0)
cnt++;
return cnt;
}
# | 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... |