QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#244384#7687. Randias Permutation TaskzhouchenfengWA 0ms3720kbC++141.4kb2023-11-09 00:50:272023-11-09 00:50:28

Judging History

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

  • [2023-11-09 00:50:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3720kb
  • [2023-11-09 00:50:27]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

#define int long long

void solve(){
	int n,m;
	cin >> n >> m;
	int a[m + 1][n + 1];
	for (int i = 1;i <= m;i ++){
		for (int j = 1;j <= n;j ++)
			cin >> a[i][j];
	}
	//int res[362880][n + 1];
	int ans = 0;
	int res[362][n + 1];
	int cnt = 0;
	for (int i = 1;i <= m;i ++){
		ans = cnt;
		for (int j = 0;j < ans;j ++){
			int c[n + 1];
			bool check = 1;
			for (int k = 1;k <= n;k ++)
				c[k] = res[j][a[i][k]];
			for (int j = 0;j < ans;j ++){
				bool f = 1;
				for (int k = 1;k <= n;k ++)
					if (res[j][k] != res[i][k]){
						f = 0;
						break;
					}
				if (f){
					check = 0;
					break;
				}
			}
			if (check){
				for (int j = 1;j <= n;j ++)
					res[cnt][j] = c[j];
				cnt ++;
			}
		}
		
		
		
		//shifouchongfu
		bool check = 1;
		for (int j = 0;j < cnt;j ++){
			bool f = 1;
			for (int k = 1;k <= n;k ++)
				if (res[j][k] != a[i][k]){
					f = 0;
					break;
				}
			if (f){
				check = 0;
				break;
			}
		}
		if (check){
			for (int j = 1;j <= n;j ++)
				res[cnt][j] = a[i][j];
			cnt ++;
		}	
		
	}
	cout << cnt << "\n";
	/*for (int i = 0;i < cnt;i ++){
		for (int j = 1;j <= n;j ++)
			cout << res[i][j] << " ";
		cout << "\n";
	}*/
	
//	map<vector<int> , bool> mp;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	solve();
}

详细

Test #1:

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

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

input:

2 1
2 1

output:

1

result:

ok 1 number(s): "1"

Test #3:

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

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:

181

result:

wrong answer 1st numbers differ - expected: '1', found: '181'