Submission #1811067
Source Code Expand
#include<bits/stdc++.h> using namespace std; using ll = long long; unordered_map<ll, int>cnt; int g2; ll calc (int *a) { ll ans = 0; g2 = 0; for (int i = 0; i < 4; ++i) { ll tmp = 0; for (int j = 0; j < 4; ++j) tmp = tmp << 10 | a[(i + j) & 3]; if (tmp > ans) ans = tmp, g2 = 1; else if (tmp == ans) ++g2; } return ans; } const int N = 404; int p[N][4], n, tt[4]; ll a[4], ans, v; int main () { scanf("%d", &n); for (int i = 0; i < n; ++i) { for (int j = 0; j < 4; ++j) scanf("%d", &p[i][j]), ++p[i][j]; ++cnt[calc(p[i])]; } for (int i = 0; i < n; ++i) { for (int j = i + 1; j < n; ++j) { --cnt[calc(p[i])]; --cnt[calc(p[j])]; for (int k = 0; k < 4; ++k) { v = 1; for (int t = 0; t < 4; ++t) { tt[0] = p[i][(t + 1) & 3]; tt[1] = p[i][t]; tt[2] = p[j][(k + 5 - t) & 3]; tt[3] = p[j][(k - t + 4) & 3]; a[t] = calc(tt); v *= g2; } for (int t = 0; t < 4; ++t) v *= cnt[a[t]]--; for (int t = 0; t < 4; ++t) ++cnt[a[t]]; ans += v; } ++cnt[calc(p[i])]; ++cnt[calc(p[j])]; } } printf("%lld\n", ans / 3); return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Building Cubes with AtCoDeer |
User | DraZxlNDdt |
Language | C++14 (GCC 5.4.1) |
Score | 900 |
Code Size | 1201 Byte |
Status | AC |
Exec Time | 615 ms |
Memory | 58384 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:23:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^ ./Main.cpp:25:63: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] for (int j = 0; j < 4; ++j) scanf("%d", &p[i][j]), ++p[i][j]; ^
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 | 1 ms | 256 KB |
0_001.txt | AC | 1 ms | 256 KB |
0_002.txt | AC | 1 ms | 256 KB |
1_003.txt | AC | 67 ms | 256 KB |
1_004.txt | AC | 6 ms | 256 KB |
1_005.txt | AC | 75 ms | 256 KB |
1_006.txt | AC | 56 ms | 256 KB |
1_007.txt | AC | 74 ms | 256 KB |
1_008.txt | AC | 66 ms | 256 KB |
1_009.txt | AC | 85 ms | 256 KB |
1_010.txt | AC | 14 ms | 256 KB |
1_011.txt | AC | 86 ms | 384 KB |
1_012.txt | AC | 2 ms | 256 KB |
1_013.txt | AC | 584 ms | 58256 KB |
1_014.txt | AC | 4 ms | 768 KB |
1_015.txt | AC | 615 ms | 58320 KB |
1_016.txt | AC | 90 ms | 15348 KB |
1_017.txt | AC | 583 ms | 58384 KB |
1_018.txt | AC | 582 ms | 58256 KB |
1_019.txt | AC | 590 ms | 58256 KB |