Snowflake Snow SnowflakesTime Limit: 4000 MS Memory Limit: 65536 KTotal Submissions: 24826 Accepted: 6474 Description You may have heard that no two snowflakes are alike. your task is to write a program to determine whether this is really true. your program will read information about a collection of snowflakes, and search for a pair that may be identical. each snowflake has six arms. for each snowfla Ke, your program will be provided with a measurement of the length of each of the six arms. any pair of snowflakes which have the same lengths of corresponding arms shocould be flagged by your program as possibly identical. input The first line of input will contain in a single integer n, 0 <n ≤ 100000, the number of snowflakes to follow. this will be followed by n lines, each describing a snowflake. Each snowflake will be described by a line containing six integers (each integer is at least 0 and less than 10000000), the lengths of the arms of the snow ake. the lengths of the arms will be given in order around the snowflake (either clockwise or counterclockwise), but they may begin with any of the six arms. for example, the same snowflake cocould be described as 1 2 3 4 5 6 or 4 3 2 1 6 5. outp Ut If all of the snowflakes are distinct, your program shocould print the message: No two snowflakes are alike. if there is a pair of possibly identical snow akes, your program shocould print the message: Twin snowflakes found. sample Input 21 2 3 4 5 64 3 2 1 6 5 Sample Output Twin snowflakes found. source CCC 2007 uses hash for this question. It has never been used before. It is confused when used. There may be conflicts with hash, and there must be methods to deal with conflicts, this question does not need to be rotated in the forward and backward directions from six points during rotation. This will time out, as long as the minimum value is recorded The small value can be rotated clockwise and counterclockwise. Note that there are more than one minimum value. There may be multiple minimum values [plain] # include <stdio. h> # include <string. h> struct num {int pos; int next;} a [1000000]; int B [1000003], c [10], e [7], vex [200010] [7]; int maxlen = 1000003, s; int check [1000003]; int main () {int I, j, n, m, t, sum, tag, x, y, min, k, u; scanf ("% d", & n); tag = 0; s = 1; memset (B,-1, sizeof (B); memset (check, 0, sizeof (check); for (I = 1; I <= n; I ++) {min = 0x7fffffff; k = 0; for (j = 1; j <= 6; j ++) {scanf ("% D ", & c [j]); if (min> c [j]) {min = c [j]; k = 0; e [k ++] = j;} else if (min = c [j]) {e [k ++] = j ;}} if (! Tag) {for (u = 0; u <= K-1; u ++) {j = e [u]; y = 1; sum = c [j] % maxlen; vex [s] [y ++] = c [j]; for (x = J-1; x> = 1; x --) {vex [s] [y ++] = c [x]; sum = (sum * 10% maxlen + c [x] % maxlen) % maxlen ;} for (x = 6; x> = j + 1; x --) {vex [s] [y ++] = c [x]; sum = (sum * 10% maxlen + c [x] % maxlen) % maxlen;} if (! Check [sum]) {check [sum] = 1; a [s]. pos = s; a [s]. next = B [sum]; B [sum] = s; s ++;} else {for (x = B [sum]; x! =-1; x = a [x]. next) {for (y = 1; y <= 6; y ++) {if (vex [s] [y]! = Vex [a [x]. pos] [y]) {break ;}}if (y = 7) {break ;}} if (x! =-1) {tag = 1; break;} else {a [s]. pos = s; a [s]. next = B [sum]; B [sum] = s; s ++ ;}} y = 1; sum = c [j] % maxlen; vex [s] [y ++] = c [j]; for (x = j + 1; x <= 6; x ++) {vex [s] [y ++] = c [x]; sum = (sum * 10% maxlen + c [x] % maxlen) % maxlen ;} for (x = 1; x <= J-1; x ++) {vex [s] [y ++] = c [x]; sum = (sum * 10% maxlen + c [x] % maxlen) % maxlen;} if (! Check [sum]) {check [sum] = 1; a [s]. pos = s; a [s]. next = B [sum]; B [sum] = s; s ++;} else {for (x = B [sum]; x! =-1; x = a [x]. next) {for (y = 1; y <= 6; y ++) {if (vex [s] [y]! = Vex [a [x]. pos] [y]) {break ;}}if (y = 7) {break ;}} if (x! =-1) {tag = 1; break;} else {a [s]. pos = s; a [s]. next = B [sum]; B [sum] = s; s ++; }}}} if (tag) {printf ("Twin snowflakes found. \ n ");} else {printf (" No two snowflakes are alike. \ n ") ;}return 0 ;}