QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#743267#9578. 爱上字典jdyt11TL 0ms0kbC++231.1kb2024-11-13 18:46:142024-11-13 18:46:14

Judging History

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

  • [2024-11-13 18:46:14]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-11-13 18:46:14]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define ll long long
#define inf 0x3f3f3f3f
#define ull unsigned long long
#define pll pair<ll,ll>
#define ls d*2
#define rs d*2+1
#define mid (l+r)/2
#define lowbit(x) (x&(-x))
//#define endl "\n"
#define all(x) x.begin(),x.end()
#define int long long
//mt19937 seed;
//uniform_int_distribution<int>num(0,2e9);
const int N=2e5+10;
const int M=33;



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int _=1;//cin>>_;
    while(_--){
        string s;
        char ch;
        ch=getchar();
        while(!(ch>='0'&&ch<='9')&&ch!='\n')s+=ch,ch=getchar();
        int sz=s.length();
        for(int i=0;i<sz;i++)if(s[i]>='A'&&s[i]<='Z')s[i]+=32;
        int n;
        cin>>n;
        set<string>mp;
        for(int i=0;i<n;i++){
        	string t;
        	cin>>t;
        	mp.insert(t);
		}
		int ans=0;
		for(int i=0;i<sz;i++){
			string temp="";
			while(i<sz&&s[i]!=' '){
				if(s[i]>='a'&&s[i]<='z')temp+=s[i];
				i++;
			}
			if(!mp.count(temp))ans++,mp.insert(temp);
		}
		cout<<ans<<endl;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Time Limit Exceeded

input:

I love Liaoning. Love Dalian!
1
love

output:


result: