QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#788257 | #9578. 爱上字典 | abovecloud# | WA | 118ms | 18392kb | C++23 | 1.6kb | 2024-11-27 16:22:00 | 2024-11-27 16:22:02 |
Judging History
answer
/*** WORK : 省赛\2024大连省赛\a.cpp ***/
/*** TIME : 2024/11/27 16:08 ***/
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define pb push_back
#define se second
#define fi first
#define int long long
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int MOD = (int)1e9 + 7;
const int INF = INT_MAX;
int p = 30;
int f(char c)
{
if (c <= 'Z' && c >= 'A')
{
return (c - 'A' + 1);
}
if (c <= 'z' && c >= 'a')
{
return (c - 'a' + 1);
}
return 0;
}
void solve()
{
string s;
getline(cin,s);
set<int> mp;
int cur = 0;
int len = 0;
// cout << s << endl;
for (char c:s)
{
int t = f(c);
if(t==0){
// cout << cur << endl;
if(cur > 0 && len <= 30){
mp.insert(cur);
}
cur = 0;
len = 0;
}else{
(cur = cur * p + t)%=MOD;
len ++;
}
}
if(cur > 0 && len <= 30){
mp.insert(cur);
}
int n;
cin >> n;
while(n--){
string ss;
cin >> ss;
int res = 0;
for(char c:ss){
(res = res * p + f(c))%=MOD;
}
if(mp.count(res)){
mp.erase(res);
}
}
cout << mp.size() << endl;
}
int32_t main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cout << fixed << setprecision(12);
int T = 1;
T = 1;
while (T--)
solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3612kb
input:
I love Liaoning. Love Dalian! 1 love
output:
3
result:
ok single line: '3'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
Sulfox Loves Furry! Fur fur Furred. 2 anthropomorphic furry
output:
4
result:
ok single line: '4'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3516kb
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: -100
Wrong Answer
time: 118ms
memory: 18392kb
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:
201948
result:
wrong answer 1st lines differ - expected: '201961', found: '201948'