QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#248112#7687. Randias Permutation Taskucup-team1074WA 0ms3868kbC++201.3kb2023-11-11 17:33:192023-11-11 17:33:19

Judging History

你现在查看的是最新测评结果

  • [2023-11-11 17:33:19]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3868kb
  • [2023-11-11 17:33:19]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define pb push_back
#define x first
#define y second 
#define endl '\n'
const LL maxn = 4e05+7;
const LL N=1e05+10;
const LL mod=1e09+7;
typedef pair<int,int>pl;
priority_queue<LL , vector<LL>, greater<LL> >t;
priority_queue<LL> q;
LL gcd(LL a, LL b){
	return b > 0 ? gcd(b , a % b) : a;
}

LL lcm(LL a , LL b){
	return a / gcd(a , b) * b;
}
int n , m;
void merge(vector<int> a , vector<int>b , vector<int>&c){
	for(int i = 0 ; i < n ; i ++){
		c[i] = a[b[i]];
	}
}
void solve() 
{	
	cin >> n >> m;
	vector<int>v[m];
	map< vector<int> , int>mp;
	int out = 0;
	for(int i = 0 ; i < m ; i++){
		for(int j = 0 ; j < n ; j ++){
			int x;
			cin>>x;
			v[i].pb(x);
		}
	}
	vector< vector<int> > ans;
	ans.pb(v[0]);
	mp[v[0]] = 1;
	for(int i = 1 ; i < m ; i ++){
		int len = ans.size();
		for(int j = 0 ; j < len ; j ++){
			vector<int> neww;
			for(int k = 0 ; k < n ; k ++){
				neww.pb(ans[j][v[i][k]]);
			}
			if(mp[neww] == 0){
				ans.pb(neww);
				mp[neww]++;
			}
		}
	}
	cout<<ans.size();
}            
int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(10);
    int t=1;
//	cin>>t;
    while(t--)
    {
    	solve();
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3668kb

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: 3576kb

input:

2 1
2 1

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3868kb

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'