QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#286459 | #7687. Randias Permutation Task | etohari# | TL | 269ms | 3860kb | C++14 | 1.4kb | 2023-12-17 22:14:27 | 2023-12-17 22:14:28 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#ifndef LOCAL
#define cerr \
if (0) cerr
#endif
vector<int> apply(vector<int> a, vector<int> b) {
// assert(a.size() == b.size());
vector<int> c(a.size());
for (int i = 0; i < a.size(); i++) {
c[i] = a[b[i]];
}
return c;
}
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifdef LOCAL
#define task "a"
#else
#define task ""
#endif
if (fopen(task ".inp", "r")) {
freopen(task ".inp", "r", stdin);
freopen(task ".ans", "w", stdout);
}
int n, m;
cin >> n >> m;
vector<vector<int>> a(m, vector<int>(n));
for (auto& v : a) {
for (int& x : v) cin >> x, --x;
}
// for (auto v : a) {
// for (int x : v) {
// cerr << x << " ";
// }
// cer
// }
// if (m <= 18) {
vector<int> p;
map<vector<int>, int> mp;
for (int mask = 1; mask < 1 << m; mask++) {
vector<int> c(n);
iota(c.begin(), c.end(), 0);
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (mask >> j & 1) {
c[i] = a[j][c[i]];
}
}
}
++mp[c];
}
cout << mp.size() << "\n";
// for (auto [v, _] : mp) {
// for (int i : v) cerr << i << " ";
// cerr << endl;
// }
return 0;
// }
// n <= 10
// duyet giai thua ???
// biet hoan vi p[.]
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3564kb
input:
5 4 1 2 3 4 5 5 1 3 4 2 3 4 1 5 2 5 2 4 1 3
output:
8
result:
ok 1 number(s): "8"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
2 1 2 1
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 269ms
memory: 3620kb
input:
1 180 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
180 1 52 71 167 89 165 102 119 125 9 128 180 24 48 172 108 22 164 28 159 111 30 91 67 51 136 97 126 133 177 65 115 157 114 11 171 178 23 127 163 103 99 18 56 94 176 77 44 1 124 74 61 87 4 40 63 92 169 84 146 6 88 55 152 49 10 90 43 174 70 50 69 154 73 147 110 20 82 59 112 12 64 143 16 138 5 170 155 ...
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: -100
Time Limit Exceeded
input:
2 90 1 2 1 2 1 2 1 2 2 1 2 1 2 1 2 1 1 2 2 1 1 2 1 2 1 2 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 2 1 1 2 2 1 1 2 2 1 1 2 1 2 2 1 1 2 2 1 2 1 2 1 2 1 1 2 2 1 2 1 2 1 2 1 1 2 1 2 2 1 2 1 1 2 1 2 1 2 2 1 1 2 2 1 2 1 1 2 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 2 1 1 2 1 2 2 1 1 2 1 2...