Submission #1690975
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector <int> VI;
int n;
LL ans,s;
map <VI,int> M;
VI c[405],x,y,z[4];
void getmin(VI &a)
{
VI b=a;
for (int i=1,t; i<4; i++)
{
t=b[0],b[0]=b[1],b[1]=b[2],b[2]=b[3],b[3]=t;
if (b<a) a=b;
}
}
int cnt(VI a)
{
int cnt=1; VI b=a;
for (int i=1,t; i<4; i++)
{
t=b[0],b[0]=b[1],b[1]=b[2],b[2]=b[3],b[3]=t;
if (a==b) cnt++;
}
return cnt;
}
void work()
{
scanf("%d",&n);
for (int i=1; i<=n; i++)
{
c[i].resize(4);
for (int j=0; j<4; j++) scanf("%d",&c[i][j]);
getmin(c[i]),M[c[i]]++;
}
for (int i=0; i<4; i++) z[i].resize(4);
for (int i=1; i<=n; i++)
for (int j=1; j<i; j++)
{
M[x=c[i]]--,M[y=c[j]]--,reverse(x.begin(),x.end());
for (int k=0,t; k<4; k++)
{
z[0][0]=x[0],z[0][1]=x[1],z[0][2]=y[1],z[0][3]=y[0];
z[1][0]=x[1],z[1][1]=x[2],z[1][2]=y[2],z[1][3]=y[1];
z[2][0]=x[2],z[2][1]=x[3],z[2][2]=y[3],z[2][3]=y[2];
z[3][0]=x[3],z[3][1]=x[0],z[3][2]=y[0],z[3][3]=y[3];
s=1;
for (int l=0; l<4; l++) getmin(z[l]),s*=cnt(z[l])*(M[z[l]]--);
ans+=s;
for (int l=0; l<4; l++) M[z[l]]++;
t=y[0],y[0]=y[1],y[1]=y[2],y[2]=y[3],y[3]=t;
}
M[c[i]]++,M[c[j]]++;
}
printf("%lld",ans/3);
}
int main()
{
work();
return 0;
}
Submission Info
Compile Error
./Main.cpp: In function ‘void work()’:
./Main.cpp:34:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
./Main.cpp:38:49: 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",&c[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 |
233 ms |
256 KB |
1_004.txt |
AC |
18 ms |
256 KB |
1_005.txt |
AC |
285 ms |
256 KB |
1_006.txt |
AC |
198 ms |
256 KB |
1_007.txt |
AC |
326 ms |
256 KB |
1_008.txt |
AC |
289 ms |
256 KB |
1_009.txt |
AC |
402 ms |
384 KB |
1_010.txt |
AC |
60 ms |
256 KB |
1_011.txt |
AC |
563 ms |
512 KB |
1_012.txt |
AC |
5 ms |
384 KB |
1_013.txt |
AC |
1659 ms |
119424 KB |
1_014.txt |
AC |
11 ms |
1664 KB |
1_015.txt |
AC |
1572 ms |
139776 KB |
1_016.txt |
AC |
360 ms |
38656 KB |
1_017.txt |
AC |
1584 ms |
139904 KB |
1_018.txt |
AC |
1557 ms |
139776 KB |
1_019.txt |
AC |
1645 ms |
137984 KB |