QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#254369 | #7687. Randias Permutation Task | sundage# | WA | 1ms | 3508kb | C++17 | 837b | 2023-11-18 11:38:49 | 2023-11-18 11:38:49 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, m;
map<vector<int>, int>mp;
void solve() {
cin >> n >> m;
vector<vector<int>>g(m);
vector<vector<int>>h;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
int a;
cin >> a;
g[i].push_back(a);
}
}
h.push_back(g[0]);
for (int i = 1; i < m; i++) {
int sum = h.size();
vector<int>c(n);
if (mp[g[i]] == 0) {
mp[g[i]] = 1;
h.push_back(g[i]);
}
for (int j = 0; j < sum; j++) {
for (int k = 1; k <= n; k++) {
c[k - 1] = h[j][g[i][k - 1] - 1];
}
if (mp[c] == 0) {
mp[c] = 1;
h.push_back(c);
}
}
}
cout << h.size() << endl;
return;
}
signed main() {
ios::sync_with_stdio(false);
int tt = 1;
// cin >> tt;
while (tt--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3424kb
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: 3432kb
input:
2 1 2 1
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3508kb
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:
2
result:
wrong answer 1st numbers differ - expected: '1', found: '2'