QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#800667 | #7687. Randias Permutation Task | UESTC_DebugSimulator# | WA | 1ms | 3860kb | C++17 | 798b | 2024-12-06 14:13:27 | 2024-12-06 14:13:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=185;
const int base=197,M=200400217;
int n,m,a[N][N];
struct node{
int a[N];
}tmp;
vector<node> v;
map<int,int>mp;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n>>m;
for(int i=1;i<=m;i++){
int s=0;
for(int j=1;j<=n;j++){
cin>>a[i][j];
s=(1ll*s*base%M+a[i][j])%M;
}
mp[s]=1;
}
int ans=m;
for(int i=1;i<=m;i++){
for(auto x:v){
int s=0;
for(int j=1;j<=n;j++){
tmp.a[j]=x.a[a[i][j]];
s=(1ll*s*base%M+tmp.a[j])%M;
}
if(!mp.count(s)){
mp[s]=1;
v.push_back(tmp);
ans++;
if(ans>1e9+7)ans-=1e9+7;
}
}
for(int j=1;j<=n;j++){
tmp.a[j]=a[i][j];
}
v.push_back(tmp);
}
cout<<ans<<"\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3676kb
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: 3672kb
input:
2 1 2 1
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3860kb
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:
180
result:
wrong answer 1st numbers differ - expected: '1', found: '180'