5081. 重复局面
摘要
Title: 5081. 重复局面
Tag: 哈希表
Memory Limit: 64 MB
Time Limit: 1000 ms
Powered by:NEFU AB-IN
5081. 重复局面
-
题意
判断棋子局面是否重复
-
思路
直接将棋子局面放进哈希表中即可
-
代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44/*
* @Author: NEFU AB-IN
* @Date: 2023-08-23 17:28:10
* @FilePath: \Acwing\5081\5081.cpp
* @LastEditTime: 2023-08-23 19:15:20
*/
using namespace std;
typedef pair<int, int> PII;
const int N = 1e5 + 10, INF = 0x3f3f3f3f;
unordered_map <string, int> st;
signed main()
{
// freopen("Tests/input_1.txt","r",stdin);
IOS;
int n;
cin >> n;
cin.ignore();
for(int i = 1; i <= n; ++ i){
string s;
for(int i = 1; i <= 8; ++ i){
string ss;
getline(cin, ss);
s += ss;
}
st[s] += 1;
cout << st[s] << '\n';
}
return 0;
}