| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 584020 | eecs | Semafor (COI20_semafor) | C++17 | 8 ms | 436 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int P = 1000000007, mask[] = {10, 2, 9, 7, 18, 21, 12, 3, 29, 23};
int m, X;
ll n, K;
auto mul = [](auto A, auto B) {
int n = A.size();
decltype(A) C{};
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) if (A[i][j]) {
for (int k = 0; k < n; k++) {
C[i][k] = (C[i][k] + 1LL * A[i][j] * B[j][k]) % P;
}
}
}
return C;
};
auto qp = [](auto A, ll k) {
decltype(A) B{};
for (int i = 0; i < A.size(); i++) {
B[i][i] = 1;
}
for (; k; k >>= 1, A = mul(A, A)) {
if (k & 1) B = mul(B, A);
}
return B;
};
int main() {
cin >> m >> n >> K >> X;
if (m == 1) {
typedef array<array<int, 32>, 32> mat1;
mat1 nxt{};
for (int i = 0; i < 32; i++) {
for (int j = 0; j < 5; j++) {
nxt[i][i ^ (1 << j)]++;
}
}
typedef array<array<int, 10>, 10> mat2;
auto A = qp(nxt, K);
mat2 tr;
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
tr[i][j] = A[mask[i]][mask[j]];
}
}
mat2 res{};
res[0][X] = 1, res = mul(res, qp(tr, n / K));
A = qp(nxt, n % K);
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
tr[i][j] = A[mask[i]][mask[j]];
}
}
res = mul(res, tr);
for (int i = 0; i < 10; i++) {
cout << res[0][i] << "\n";
}
exit(0);
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
