Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

C++会卡掉，交G++

Posted by ACAccepted at 2019-02-11 22:47:13 on Problem 3349
```#include <cstdio>
using namespace std;

{
int x=0,f=1;char c=getchar();
while (c<'0' || c>'9'){if (c=='-')f=-1;c=getchar();}
while (c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-48;c=getchar();}
return x*f;
}

const int MAXN=1200010;
const int MAXH=1200007;
int n,id;
bool flag=false;
int num[2][12];

struct memory
{
int num[6],nx;
}get_num[MAXN];

int get_hash(int num[],int loca)
{
int res=0;
for (int i=0;i<6;i++)res+=num[loca+i];
return res%MAXH;
}

bool cmp(int a[],int loca,int b[])
{
for (int i=0;i<6;i++)if (a[i+loca]!=b[i])return false;
return true;
}

void cpy(int a[],int loca,int b[])
{
for (int i=0;i<6;i++)b[i]=a[i+loca];
}

void insert(int save[],int loca,int Hash_code)
{
}

bool find(int num[],int loca)
{
int code=get_hash(num,loca);
if (cmp(num,loca,get_num[k].num))return true;
insert(num,loca,code);
return false;
}

int main()
{
while (n--)
{
for (int i=0;i<6;i++)
{
num[0][i+6]=num[0][i];
}
if (flag)continue;
for (int i=0;i<6;i++)num[1][i]=num[1][i+6]=num[0][5-i];
for (int i=0;i<6;i++)
{
if (find(num[0],i)||find(num[1],i))
{
flag=true;break;
}
}
}
printf("%s\n",flag?"Twin snowflakes found.":"No two snowflakes are alike.");
return 0;
}```

Followed by: