QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#788257#9578. 爱上字典abovecloud#WA 118ms18392kbC++231.6kb2024-11-27 16:22:002024-11-27 16:22:02

Judging History

你现在查看的是最新测评结果

  • [2024-11-27 16:22:02]
  • 评测
  • 测评结果:WA
  • 用时:118ms
  • 内存:18392kb
  • [2024-11-27 16:22:00]
  • 提交

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();
}

Details

Tip: Click on the bar to expand more detailed information

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'