6289 | 2023-11-13 13:49:27 | aballa | Forgó rulettkerék | cpp17 | Wrong answer 0/100 | 1.57s | 11584 KiB |
#include <bits/stdc++.h>
int n, m;
std::string tagid(std::string str) {
std::string s = str + str, k, min;
min = str;
for(int i = 1; i < m; i++) {
k = std::string(&s[i], &s[i+m]);
if(min > k) min = k;
}
return min;
}
int main() {
long long count = 0, cachecount;
std::ios::sync_with_stdio(false);
std::cin.tie(0);
std::string cache, cache2;
std::vector<std::string> ids;
std::cin >> n >> m;
for(int i = 0; i < n; i++) {
std::cin >> cache;
ids.push_back(tagid(cache));
}
for (int i = 0; i < n; i++) {
cachecount = 0;
for (int j = 0; j < n-i-1; j++) {
if(ids[i] == ids[n-j-1]) {
cachecount++;
}
}
count = count + (cachecount*(cachecount+1))/2;
}
std::cout << count;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1832 KiB | ||||
2 | Accepted | 3ms | 2056 KiB | ||||
subtask2 | 0/20 | ||||||
3 | Accepted | 3ms | 2272 KiB | ||||
4 | Wrong answer | 3ms | 2480 KiB | ||||
5 | Wrong answer | 3ms | 2668 KiB | ||||
6 | Wrong answer | 3ms | 2764 KiB | ||||
7 | Wrong answer | 3ms | 3020 KiB | ||||
8 | Wrong answer | 3ms | 2980 KiB | ||||
9 | Wrong answer | 3ms | 3232 KiB | ||||
subtask3 | 0/15 | ||||||
10 | Wrong answer | 18ms | 3880 KiB | ||||
11 | Wrong answer | 25ms | 4064 KiB | ||||
12 | Wrong answer | 21ms | 3928 KiB | ||||
13 | Wrong answer | 18ms | 3744 KiB | ||||
14 | Wrong answer | 24ms | 3920 KiB | ||||
15 | Wrong answer | 24ms | 4076 KiB | ||||
16 | Accepted | 23ms | 4164 KiB | ||||
17 | Wrong answer | 24ms | 4376 KiB | ||||
subtask4 | 0/65 | ||||||
18 | Wrong answer | 123ms | 5844 KiB | ||||
19 | Wrong answer | 126ms | 5568 KiB | ||||
20 | Wrong answer | 200ms | 5340 KiB | ||||
21 | Wrong answer | 71ms | 5660 KiB | ||||
22 | Wrong answer | 87ms | 5604 KiB | ||||
23 | Wrong answer | 119ms | 5384 KiB | ||||
24 | Wrong answer | 79ms | 5556 KiB | ||||
25 | Wrong answer | 902ms | 5740 KiB | ||||
26 | Time limit exceeded | 1.57s | 11356 KiB | ||||
27 | Wrong answer | 1.154s | 7760 KiB | ||||
28 | Time limit exceeded | 1.557s | 4396 KiB | ||||
29 | Time limit exceeded | 1.562s | 11368 KiB | ||||
30 | Time limit exceeded | 1.562s | 11584 KiB |