이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "september.h"
#include <iostream>
#include <vector>
#define ll long long
using namespace std;
bool B[100000][5];
ll f, x, in[100000][5], tot[100000], cnt;
int solve(int N, int M, std::vector<int> F, std::vector<std::vector<int>> S) {
f = cnt = x = 0;
for (int i=1; i<N; ++i) {
tot[i] = 0;
for (int j=0; j<M; ++j) {
B[i][j] = 0;
++in[F[i]][j];
}
}
for (int i=0; i<N-1; ++i) {
for (int j=0; j<M; ++j) {
auto u = S[j][i];
++tot[u];
if (tot[u] == M) ++x;
B[u][j] = 1;
--in[F[u]][j];
if (B[F[u]][j] && !in[F[u]][j]) --cnt;
if (in[u][j]) ++cnt;
}
if (!cnt && x == i+1) ++f;
}
return f;
}
# | 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... |