Submission #1514734
Source Code Expand
#include <map> #include <vector> #include <iostream> #include <algorithm> using namespace std; int N; vector<int> a[409]; map<vector<int>, int> d; long long perm(int n, int k) { long long ret = 1; for (int i = n; i > n - k; i--) ret *= i; return ret; } vector<int> univec(vector<int> v) { vector<int> ret = v; for (int i = 0; i < 3; i++) { v.push_back(v[0]); v.erase(v.begin()); ret = min(ret, v); } return ret; } int main() { cin >> N; for (int i = 0; i < N; i++) { a[i].resize(4); for (int j = 0; j < 4; j++) cin >> a[i][j]; a[i] = univec(a[i]); d[a[i]]++; } long long ret = 0; for (int i = 0; i < N; i++) { d[a[i]]--; for (int j = i + 1; j < N; j++) { d[a[j]]--; for (int ri = 0; ri < 4; ri++) { a[i].push_back(a[i][0]); a[i].erase(a[i].begin()); for (int rj = 0; rj < 4; rj++) { a[j].push_back(a[j][0]); a[j].erase(a[j].begin()); map<vector<int>, int> e; e[univec({ a[j][1], a[j][0], a[i][1], a[i][0] })]++; e[univec({ a[j][0], a[j][3], a[i][2], a[i][1] })]++; e[univec({ a[j][3], a[j][2], a[i][3], a[i][2] })]++; e[univec({ a[j][2], a[j][1], a[i][0], a[i][3] })]++; long long res = 1; for (pair<vector<int>, int> k : e) { res *= perm(d[k.first], k.second); if (d[k.first] == 0) d.erase(k.first); if (k.first[0] == k.first[1] && k.first[1] == k.first[2] && k.first[2] == k.first[3]) { for (int l = 0; l < k.second; l++) res *= 4; } else if (k.first[0] == k.first[2] && k.first[1] == k.first[3]) { for (int l = 0; l < k.second; l++) res *= 2; } } ret += res; } } d[a[j]]++; } } cout << ret / 4 << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Building Cubes with AtCoDeer |
User | square1001 |
Language | C++14 (GCC 5.4.1) |
Score | 900 |
Code Size | 1737 Byte |
Status | AC |
Exec Time | 3400 ms |
Memory | 384 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 900 / 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 | 2 ms | 256 KB |
0_002.txt | AC | 1 ms | 256 KB |
1_003.txt | AC | 1068 ms | 256 KB |
1_004.txt | AC | 75 ms | 256 KB |
1_005.txt | AC | 1499 ms | 256 KB |
1_006.txt | AC | 1068 ms | 256 KB |
1_007.txt | AC | 1919 ms | 256 KB |
1_008.txt | AC | 1697 ms | 256 KB |
1_009.txt | AC | 2525 ms | 256 KB |
1_010.txt | AC | 394 ms | 256 KB |
1_011.txt | AC | 3400 ms | 384 KB |
1_012.txt | AC | 18 ms | 256 KB |
1_013.txt | AC | 3133 ms | 384 KB |
1_014.txt | AC | 30 ms | 256 KB |
1_015.txt | AC | 2981 ms | 384 KB |
1_016.txt | AC | 837 ms | 256 KB |
1_017.txt | AC | 3005 ms | 384 KB |
1_018.txt | AC | 3089 ms | 384 KB |
1_019.txt | AC | 3047 ms | 384 KB |