6286 | 2023-11-13 13:33:50 | aballa | Forgó rulettkerék | cpp17 | Wrong answer 0/100 | 1.582s | 12688 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() {
int count, 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++) {
if (ids[i] == "#") {continue;}
cachecount = 0;
for (int j = 0; j < n-i-1; j++) {
if (ids[n-j-1] == "#") {continue;}
if(ids[i] == ids[n-j-1]) {
cachecount++;
ids[n-j-1] = "#";
}
}
count = count + (cachecount*(cachecount+1))/2;
}
std::cout << count;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1700 KiB | ||||
2 | Wrong answer | 3ms | 1928 KiB | ||||
subtask2 | 0/20 | ||||||
3 | Wrong answer | 3ms | 2144 KiB | ||||
4 | Wrong answer | 3ms | 2348 KiB | ||||
5 | Wrong answer | 3ms | 2584 KiB | ||||
6 | Wrong answer | 3ms | 2664 KiB | ||||
7 | Wrong answer | 3ms | 3004 KiB | ||||
8 | Wrong answer | 3ms | 3064 KiB | ||||
9 | Wrong answer | 3ms | 3148 KiB | ||||
subtask3 | 0/15 | ||||||
10 | Wrong answer | 17ms | 4060 KiB | ||||
11 | Wrong answer | 21ms | 4112 KiB | ||||
12 | Wrong answer | 21ms | 4228 KiB | ||||
13 | Wrong answer | 17ms | 4112 KiB | ||||
14 | Wrong answer | 20ms | 4208 KiB | ||||
15 | Wrong answer | 25ms | 4356 KiB | ||||
16 | Wrong answer | 25ms | 4444 KiB | ||||
17 | Wrong answer | 25ms | 4652 KiB | ||||
subtask4 | 0/65 | ||||||
18 | Wrong answer | 64ms | 6340 KiB | ||||
19 | Wrong answer | 72ms | 6296 KiB | ||||
20 | Wrong answer | 199ms | 6332 KiB | ||||
21 | Wrong answer | 71ms | 6948 KiB | ||||
22 | Wrong answer | 71ms | 6676 KiB | ||||
23 | Wrong answer | 119ms | 6764 KiB | ||||
24 | Wrong answer | 105ms | 6972 KiB | ||||
25 | Wrong answer | 898ms | 7184 KiB | ||||
26 | Time limit exceeded | 1.582s | 12688 KiB | ||||
27 | Wrong answer | 1.036s | 8852 KiB | ||||
28 | Time limit exceeded | 1.56s | 5624 KiB | ||||
29 | Time limit exceeded | 1.565s | 12400 KiB | ||||
30 | Time limit exceeded | 1.572s | 12508 KiB |