1e5的数组过不了,1e6过的了 1e5:
#include <iostream>
#include<bits/stdc++.h>
#include <vector>
#include <map>
#include <cstring>
#include <algorithm>
#include <stack>
#include <set>
#include <cmath>
#include <queue>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <limits.h>
#include <iomanip>
using namespace std;
typedef __int128 lint;
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, string> PIS;
typedef std::pair<int, int> IntPair;
#define Pi acos(-1)
/*
Constant suspicion, constant uncertainty, is the most esential preparation for surviving a gamble!!!
============================================================================================================
*/
const ll N = 2e5+10;
const ll INF = 0x3f3f3f3f;
const ll mod = 1e9+7;
ll mo;
ll n,m,k,l,r;
ll nex[100085][28],cnt;
bool exits[100085];
string s;
set<string>st;
void insert(){
ll p=0;
for(int i=0;i<s.size();i++){
ll c=s[i]-'a';
if(!nex[p][c])nex[p][c]=++cnt;
p=nex[p][c];
}
exits[p]=1;
}
bool find(){
ll p=0;
for(int i=0;i<s.size();i++){
ll c=s[i]-'a';
if(!nex[p][c])return 0;
p=nex[p][c];
}
return exits[p];
}
void init(){
}
void solve(){
cin >> n;
while(n--){
cin >> s;
insert();
}
cin >> m;
while(m--) {
cin >> s;
if(find()&&st.find(s)==st.end()){
cout << "OK" <<endl;
st.insert(s);
continue;
}
if(st.find(s)!=st.end()){
cout << "REPEAT" <<endl;
continue;
}
cout << "WRONG" <<endl;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
// init();
ll t = 1;
// cin >>t;
mo = 0;
while (mo++ != t) {
solve();
}
return 0;
}
1e6:
#include <iostream>
#include<bits/stdc++.h>
#include <vector>
#include <map>
#include <cstring>
#include <algorithm>
#include <stack>
#include <set>
#include <cmath>
#include <queue>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <limits.h>
#include <iomanip>
using namespace std;
typedef __int128 lint;
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, string> PIS;
typedef std::pair<int, int> IntPair;
#define Pi acos(-1)
/*
Constant suspicion, constant uncertainty, is the most esential preparation for surviving a gamble!!!
============================================================================================================
*/
const ll N = 2e5+10;
const ll INF = 0x3f3f3f3f;
const ll mod = 1e9+7;
ll mo;
ll n,m,k,l,r;
ll nex[1000085][28],cnt;
bool exits[1000085];
string s;
set<string>st;
void insert(){
ll p=0;
for(int i=0;i<s.size();i++){
ll c=s[i]-'a';
if(!nex[p][c])nex[p][c]=++cnt;
p=nex[p][c];
}
exits[p]=1;
}
bool find(){
ll p=0;
for(int i=0;i<s.size();i++){
ll c=s[i]-'a';
if(!nex[p][c])return 0;
p=nex[p][c];
}
return exits[p];
}
void init(){
}
void solve(){
cin >> n;
while(n--){
cin >> s;
insert();
}
cin >> m;
while(m--) {
cin >> s;
if(find()&&st.find(s)==st.end()){
cout << "OK" <<endl;
st.insert(s);
continue;
}
if(st.find(s)!=st.end()){
cout << "REPEAT" <<endl;
continue;
}
cout << "WRONG" <<endl;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
// init();
ll t = 1;
// cin >>t;
mo = 0;
while (mo++ != t) {
solve();
}
return 0;
}