Submission #1865229
Source Code Expand
#include<cstdio>
#include<map>
#define ll long long
using namespace std;
const int N=405;
int n,i,j,k,x,c[N][4];ll a[N],v[4],ans;
ll num(int a,int b,int c,int d){
return ((ll)a<<30)+(b<<20)+(c<<10)+d;
}
map<ll,int> mp;
void add(ll x,int k){
for (int i=4;i--;x=x>>10|(x&1023)<<30) mp[x]+=k;
}
int main(){
scanf("%d",&n);
for (i=1;i<=n;add(a[i],1),i++) for (j=0;j<4;j++)
scanf("%d",&c[i][j]),a[i]=(a[i]<<10)+c[i][j];
for (i=1;i<=n-5;i++)
for (add(a[i],-1),j=i+1;j<=n;j++){
add(a[j],-1);
for (k=4;k--;){
v[0]=num(c[i][0],c[j][k],c[j][(k+3)&3],c[i][1]);
v[1]=num(c[i][1],c[j][(k+3)&3],c[j][(k+2)&3],c[i][2]);
v[2]=num(c[i][2],c[j][(k+2)&3],c[j][(k+1)&3],c[i][3]);
v[3]=num(c[i][3],c[j][(k+1)&3],c[j][k],c[i][0]);
ll res=1;
for (x=4;x--;) res*=mp[v[x]],add(v[x],-1);
for (ans+=res,x=4;x--;) add(v[x],1);
}
add(a[j],1);
}
printf("%lld",ans);
}
Submission Info
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:15:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
./Main.cpp:17:47: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&c[i][j]),a[i]=(a[i]<<10)+c[i][j];
^
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 |
1 ms |
256 KB |
0_001.txt |
AC |
1 ms |
256 KB |
0_002.txt |
AC |
1 ms |
256 KB |
1_003.txt |
AC |
58 ms |
256 KB |
1_004.txt |
AC |
5 ms |
256 KB |
1_005.txt |
AC |
87 ms |
256 KB |
1_006.txt |
AC |
62 ms |
256 KB |
1_007.txt |
AC |
162 ms |
256 KB |
1_008.txt |
AC |
147 ms |
256 KB |
1_009.txt |
AC |
437 ms |
256 KB |
1_010.txt |
AC |
69 ms |
256 KB |
1_011.txt |
AC |
954 ms |
896 KB |
1_012.txt |
AC |
6 ms |
640 KB |
1_013.txt |
TLE |
4219 ms |
272512 KB |
1_014.txt |
AC |
21 ms |
3456 KB |
1_015.txt |
TLE |
4222 ms |
319104 KB |
1_016.txt |
AC |
947 ms |
88064 KB |
1_017.txt |
TLE |
4222 ms |
319488 KB |
1_018.txt |
TLE |
4222 ms |
318976 KB |
1_019.txt |
TLE |
4222 ms |
315008 KB |