Submission #1816212
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 object rotate() const
{
return {b, c, d, a};
}
friend inline bool operator<(const object &lhs, const object &rhs)
{
if (lhs.a != rhs.a)
return lhs.a < rhs.a;
if (lhs.b != rhs.b)
return lhs.b < rhs.b;
if (lhs.c != rhs.c)
return lhs.c < rhs.c;
return lhs.d < rhs.d;
}
};
map<object, int> all;
inline void add(object cur, int delta)
{
for (int k = 0; k < 4; ++k)
all[cur = cur.rotate()] += delta;
}
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 *= all[f1], add(f1, -1);
ways *= all[f2], add(f2, -1);
ways *= all[f3], add(f3, -1);
ways *= all[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 |
1648 Byte |
Status |
TLE |
Exec Time |
4219 ms |
Memory |
259712 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 |
74 ms |
256 KB |
1_004.txt |
AC |
6 ms |
256 KB |
1_005.txt |
AC |
144 ms |
256 KB |
1_006.txt |
AC |
100 ms |
256 KB |
1_007.txt |
AC |
239 ms |
256 KB |
1_008.txt |
AC |
212 ms |
256 KB |
1_009.txt |
AC |
586 ms |
256 KB |
1_010.txt |
AC |
92 ms |
256 KB |
1_011.txt |
AC |
1156 ms |
896 KB |
1_012.txt |
AC |
8 ms |
640 KB |
1_013.txt |
TLE |
4216 ms |
211456 KB |
1_014.txt |
AC |
22 ms |
2944 KB |
1_015.txt |
TLE |
4219 ms |
259584 KB |
1_016.txt |
AC |
970 ms |
71680 KB |
1_017.txt |
TLE |
4219 ms |
259712 KB |
1_018.txt |
TLE |
4219 ms |
259328 KB |
1_019.txt |
TLE |
4219 ms |
256768 KB |