HASHIT  Hash it!
Your task is to calculate the result of the hashing process in a table of 101 elements, containing keys that are strings of length at most 15 letters (ASCII codes 'A',...,'z'). Implement the following operations:
 find the index of the element defined by the key (ignore, if no such element),
 insert a new key into the table (ignore insertion of the key that already exists),
 delete a key from the table (without moving the others), by marking the position in table as empty (ignore nonexisting keys in the table)
When performing find, insert and delete operations define the following function:
integer Hash(string key),
which for a string key=a_{1}...a_{n} returns the value:
Hash(key)=h(key) mod 101, where
h(key)=19 *(ASCII(a_{1})*1+...+ASCII(a_{n})*n).
Resolve collisions using the open addressing method, i.e. try to insert the key into the table at the first free position: (Hash(key)+j^{2}+23*j) mod 101, for j=1,...,19.
After examining of at least 20 table entries, we assume that the insert operation cannot be performed.
Input
t [the number of test cases <= 100]
n_{1} [the number of operations (one per line)[<= 1000]
ADD:string
[or]
DEL:string
[other test cases, without empty lines betwee series]
Output
For every test case you have to create a new table, insert or delete keys, and write to the output:
the number of keys in the table [first line]
index:key [sorted by indices]
Example
Input: 1 11 ADD:marsz ADD:marsz ADD:Dabrowski ADD:z ADD:ziemii ADD:wloskiej ADD:do ADD:Polski DEL:od DEL:do DEL:wloskiej Output: 5 34:Dabrowski 46:Polski 63:marsz 76:ziemii 96:z
hide comments
usama:
20130627 17:39:47
Last edit: 20130627 17:41:06 

Syaorann:
20130124 11:35:44
just simply write the program like what it said.no other thing need to take into consideration,and u can AC it 

Siddharth Bora:
20120810 13:34:52
Important: To note that the openaddressing method calculates hashes j=1...19 on the original hash and not on the previous hash. 

Aman Gupta:
20120719 10:33:16
my solution works on ideone but here it is repeatedly giving NZEC


Giovanni Botta:
20110914 21:04:53
Is the open addressing performed by adding j^2+23*j to the previous hash code or to the original hash code h(.)?


asqwzxdfercv:
20110529 11:45:37
"After examining of at least 20 table entries"


Jeevan K. S. Chalam:
20110526 16:41:20
Done :) Last edit: 20110528 09:00:22 

kiransk:
20110414 10:33:16
input with string length ZERO allowed?


Piotr KÄ…kol:
20110409 19:09:24
@Parag gupta  "(ignore insertion of the key that already exists)"  read the specification carefully and don't assume that the input is wrong not You. 

Parag gupta:
20110321 14:54:51
the test case answer should be 6 and should contain "marsz" two times. one at index 63 and other at 87. explain plz.. 
Added by:  mima 
Date:  20040601 
Time limit:  3s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS PERL6 VB.NET 
Resource:   