# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
799557 |
2023-07-31T15:57:40 Z |
vjudge1 |
Cards (LMIO19_korteles) |
C++17 |
|
1000 ms |
30228 KB |
#include <iostream>
#include <map>
using namespace std;
map<tuple<char, char, char, char>, long long int> m;
struct DOM {
char a, b, x, y;
};
bool check(DOM aa, DOM bb) {
if (aa.a == bb.x && aa.b == bb.y) return 1;
if (aa.b == bb.a && aa.y == bb.x) return 1;
if (aa.x == bb.a && aa.y == bb.b) return 1;
if (aa.a == bb.b && aa.x == bb.y) return 1;
return 0;
}
DOM a[100005];
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
long long int n, res = 0;
cin >> n;
if (n <= 2500) {
for (int i = 1; i <= n; i++) {
cin >> a[i].a >> a[i].b >> a[i].x >> a[i].y;
for (int j = 1; j < i; j++) {
if (check(a[i], a[j])) {
res++;
}
}
}
cout << res;
return 0;
}
for (int i = 1; i <= n; i++) {
char a, b, x, y;
cin >> a >> b >> x >> y;
char r = '?';
res += m[{r, r, a, b}] + m[{b, r, y, r}] + m[{r, a, r, x}] + m[{x, y, r, r}];
res -= m[{b, a, y, x}] + m[{x, y, a, b}];
if (y == a) res -= m[{x, y, r, x}];
if (y == a) res -= m[{b, r, a, b}];
if (x == b) res -= m[{b, y, y, r}];
if (x == b) res -= m[{r, a, a, x}];
if (b == x && a == y) {
res += m[{b, a, y, x}] * 3;
}
m[{a, b, r, r}]++;
m[{r, b, r, y}]++;
m[{a, r, x, r}]++;
m[{r, r, x, y}]++;
m[{r, b, x, y}]++;
m[{a, r, x, y}]++;
m[{a, b, r, y}]++;
m[{a, b, x, r}]++;
m[{a, b, x, y}]++;
}
cout << res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
6 ms |
340 KB |
Output is correct |
8 |
Correct |
9 ms |
340 KB |
Output is correct |
9 |
Correct |
18 ms |
340 KB |
Output is correct |
10 |
Correct |
11 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1073 ms |
30228 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
199 ms |
12640 KB |
Output is correct |
3 |
Execution timed out |
1095 ms |
27592 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
6 ms |
340 KB |
Output is correct |
4 |
Correct |
9 ms |
340 KB |
Output is correct |
5 |
Correct |
18 ms |
340 KB |
Output is correct |
6 |
Correct |
11 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Execution timed out |
1073 ms |
30228 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |