Submission #1816224
Source Code Expand
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <map>
using namespace std;
typedef long long s64;
struct object
{
int a, b, c, d;
object() {}
object(const int &_a, const int &_b, const int &_c, const int &_d)
: a(_a), b(_b), c(_c), d(_d) {}
inline s64 value() const
{
return ((s64)a << 30) | (b << 20) | (c << 10) | d;
}
inline object rotate() const
{
return {b, c, d, a};
}
};
map<s64, int> all;
inline void add(object cur, int delta)
{
for (int k = 0; k < 4; ++k)
all[(cur = cur.rotate()).value()] += delta;
}
inline int query(const object &a)
{
return all[a.value()];
}
const int MaxN = 400;
int n;
object f[MaxN + 1];
int main()
{
cin >> n;
for (int i = 1; i <= n; ++i)
{
cin >> f[i].a >> f[i].b;
cin >> f[i].c >> f[i].d;
add(f[i], 1);
}
s64 res = 0;
for (int i = 1; i < n; ++i)
{
add(f[i], -1);
for (int j = i + 1; j <= n; ++j)
{
add(f[j], -1);
object cur = f[j];
for (int k = 0; k < 4; ++k)
{
object f1(cur.b, cur.a, f[i].b, f[i].a);
object f2(cur.a, cur.d, f[i].c, f[i].b);
object f3(cur.d, cur.c, f[i].d, f[i].c);
object f4(cur.c, cur.b, f[i].a, f[i].d);
s64 ways = 1;
ways *= query(f1), add(f1, -1);
ways *= query(f2), add(f2, -1);
ways *= query(f3), add(f3, -1);
ways *= query(f4);
add(f1, 1), add(f2, 1), add(f3, 1);
res += ways;
cur = cur.rotate();
}
add(f[j], 1);
}
}
cout << res << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
E - Building Cubes with AtCoDeer |
User |
InvUsr |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1571 Byte |
Status |
TLE |
Exec Time |
4230 ms |
Memory |
261760 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 900 |
Status |
|
|
Set Name |
Test Cases |
Sample |
0_000.txt, 0_001.txt, 0_002.txt |
All |
0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt |
Case Name |
Status |
Exec Time |
Memory |
0_000.txt |
AC |
2 ms |
256 KB |
0_001.txt |
AC |
1 ms |
256 KB |
0_002.txt |
AC |
1 ms |
256 KB |
1_003.txt |
AC |
42 ms |
256 KB |
1_004.txt |
AC |
4 ms |
256 KB |
1_005.txt |
AC |
67 ms |
256 KB |
1_006.txt |
AC |
48 ms |
256 KB |
1_007.txt |
AC |
136 ms |
256 KB |
1_008.txt |
AC |
121 ms |
256 KB |
1_009.txt |
AC |
358 ms |
256 KB |
1_010.txt |
AC |
60 ms |
256 KB |
1_011.txt |
AC |
778 ms |
896 KB |
1_012.txt |
AC |
6 ms |
640 KB |
1_013.txt |
TLE |
4226 ms |
224768 KB |
1_014.txt |
AC |
17 ms |
2944 KB |
1_015.txt |
TLE |
4230 ms |
259584 KB |
1_016.txt |
AC |
836 ms |
71680 KB |
1_017.txt |
TLE |
4227 ms |
261760 KB |
1_018.txt |
TLE |
4230 ms |
259328 KB |
1_019.txt |
TLE |
4230 ms |
256768 KB |