QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#765466 | #9578. 爱上字典 | forget-star# | AC ✓ | 42ms | 19596kb | C++11 | 1.5kb | 2024-11-20 14:22:19 | 2024-11-20 14:22:22 |
Judging History
answer
#include <cstdio>
#include <cstring>
#include <algorithm>
#define ll long long
using namespace std;
int read()
{
int a = 0,x = 1;char ch = getchar();
while(ch > '9' || ch < '0') {if(ch == '-') x = -1;ch = getchar();}
while(ch >='0' && ch <= '9') {a = a*10 + ch-'0';ch = getchar();}
return a*x;
}
const int N = 5e6+7,base1 = 133,base2 = 131,mod1 = 1000429,mod2 = 20190631;
char s[N];
int head[N],go[N],nxt[N],cnt,val[N];
void add(int u,int v,int w)
{
go[++cnt] = v;
nxt[cnt] = head[u];
head[u] = cnt;
val[cnt] = w;
}
int fid(int u,int v)
{
for(int e = head[u];e;e = nxt[e]) {
if(go[e] == v) return e;
}
return 0;
}
int main()
{
// freopen("in.in","r",stdin);freopen("out.out","w",stdout);
gets(s+1);int len = strlen(s+1);s[len+1] = ' ';len ++;
ll hash1 = 0,hash2 = 0;
for(int i = 1;i <= len;i ++) {
if(s[i] >= 'A' && s[i] <= 'Z') s[i] += 'a'-'A';
if(s[i] > 'z' || s[i] < 'a') {
if(hash1) {
int e = fid(hash1,hash2);
if(!e) {
add(hash1,hash2,1);
}
hash1 = hash2 = 0;
}
continue;
}
hash1 = (hash1 * base1 + s[i]) % mod1;
hash2 = (hash2 * base2 + s[i]) % mod2;
}
int n = read();
for(int i= 1;i <= n;i ++) {
scanf("%s",s+1);len = strlen(s+1);
hash1 = hash2 = 0;
for(int j = 1;j <= len;j ++) {
hash1 = (hash1 * base1 + s[j]) % mod1;
hash2 = (hash2 * base2 + s[j]) % mod2;
}
int e = fid(hash1,hash2);
val[e] = 0;
}
int ans = 0;
for(int i = 1;i <= cnt;i ++) ans += val[i];
printf("%d\n",ans);
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5728kb
input:
I love Liaoning. Love Dalian! 1 love
output:
3
result:
ok single line: '3'
Test #2:
score: 0
Accepted
time: 1ms
memory: 5808kb
input:
Sulfox Loves Furry! Fur fur Furred. 2 anthropomorphic furry
output:
4
result:
ok single line: '4'
Test #3:
score: 0
Accepted
time: 1ms
memory: 5764kb
input:
Ginkgo leaves dance lightly and fall, reflecting the autumn light on the golden ground. Time is as peaceful as when we first met. 5 ginkgo reflect is as we
output:
17
result:
ok single line: '17'
Test #4:
score: 0
Accepted
time: 38ms
memory: 16628kb
input:
Eunuchism overterrible furbelow gantlet. Sophism thyroiditis thermoelectricity hassel misreward Barolong biradiated? Sweetie fatal delinquence unseemlily beamish inwork, azyme kamias Hans asteatosis synderesis champleve cheth? Dinitrile podial presentee! Waxmaker scleroscope ratably hectography lamp...
output:
201961
result:
ok single line: '201961'
Test #5:
score: 0
Accepted
time: 42ms
memory: 17608kb
input:
Unsubsidiary unsacrificeable hacking colberter pseudoappendicitis rufescence tumbak? Hypocrize aithochroi. Spina machar proximation? Chaperone vermicide virescent Klan preplacental unabsolvedness Sarcosporida noveletter waspishness sponge trustle bistetrazole prepositure melamed, cinephone. Physopho...
output:
201951
result:
ok single line: '201951'
Test #6:
score: 0
Accepted
time: 39ms
memory: 19596kb
input:
Baikerite discontentful semicitizen Acoemetic veracity pretechnical bloodweed cytogenetic icebound disrelishable leader meltedness heroship sciniph gunsel fatalistically unreasoned anticatarrhal? Unmentioned! Overaddiction broomy misapplication hecte inflammable disheart dicaryon blacktail prisonabl...
output:
201759
result:
ok single line: '201759'
Test #7:
score: 0
Accepted
time: 40ms
memory: 17516kb
input:
Dizoic filtering damenization bistipuled Opisthothelae multiangular blaff mortally. Perfusive alkaptonuria possessorial coinstantaneousness Stanhopea Nascan. Ankylostoma aumil oxygenicity cubhood abandonee fishman poppy pickpole synkinesis arteriosclerosis coloproctitis prematrimonial pseudoviaduct ...
output:
202281
result:
ok single line: '202281'
Test #8:
score: 0
Accepted
time: 40ms
memory: 16552kb
input:
Thelorrhagia me Camaldulian Menfra me drugman pneumonolithiasis, fructose me inwit caubeen manchet! Enjeopardy me quindecennial me unrecompensable creaturize undiverting bitty dama interteam curfew excedent me me. Revealingness Nipponism opticity suwe me stilty me antiquarism Iacchic me contrapuntal...
output:
195780
result:
ok single line: '195780'
Test #9:
score: 0
Accepted
time: 16ms
memory: 8532kb
input:
Me me me me me me me me me me me me me me me. Me me. Me. Me me me me? Me me me me me me me me, me me! Me me. Me me me me me me me me me! Me me? Me me, me? Me me me me me me me me me, me me me me me? Me, me me me me me me me me me me me me me me me me? Me me me. Me me me me me, me me me me me me me! ...
output:
0
result:
ok single line: '0'
Test #10:
score: 0
Accepted
time: 16ms
memory: 9744kb
input:
Me me? Me me me me me me me me me me me, me me me. Me me me me me me me me me me me me me. Me, me me me me me me me me. Me me me me me me me me me me. Me me me me me me me me me me me me me! Me! Me me me! Me me me me me! Me me me me me me me me me me me! Me me me me me me? Me me me me me me. Me me m...
output:
0
result:
ok single line: '0'
Test #11:
score: 0
Accepted
time: 35ms
memory: 16508kb
input:
Subsemitone me pauperdom me amphopeptone me Keplerian isopolity premaniacal logia, unseducible gulper heterostylism contumeliously prevenience, clientry theurgically supportive. Me gossipiness lately electrooptic. Me. Me, boding, putrefacient unendowing hypercryalgesia me me pluviographic Elohist me...
output:
195507
result:
ok single line: '195507'
Test #12:
score: 0
Accepted
time: 1ms
memory: 5736kb
input:
I am a cat and an ant? An ape! And Imp. And imp Is I. 3 an industrialization is
output:
8
result:
ok single line: '8'
Test #13:
score: 0
Accepted
time: 1ms
memory: 5520kb
input:
Okay. 0
output:
1
result:
ok single line: '1'
Extra Test:
score: 0
Extra Test Passed