ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#197738 | #2439. 过滤 | snow_trace | 100 | 6667ms | 15856kb | C++11 | 1.3kb | 2023-11-14 09:13:47 | 2023-11-14 12:02:23 |
answer
#include<bits/stdc++.h>
using namespace std;
bool is_prime(int x){
for(int i = 2;i*i<=x;i++){
if(x%i == 0)return 0;
}return 1;
}long long mod[10];
bitset<30000005>x[4];
long long a[12];
const long long base = 71;
inline int calc(int x){
long long sum = 0;
for(int i = 1;i<=8;i++){
// cout << a[i] << endl;
sum = (sum*base+a[i]);
}sum%=mod[x];
// cout << sum << endl;
return sum;
}
void solve(){
char s[12];int op;//cout << 111 << endl;
scanf("%s",s+1);scanf("%d",&op);
for(int i = 1;i<=8;i++){
if('0'<=s[i] and s[i]<='9')a[i] = s[i]-'0';
if('A'<=s[i] and s[i]<='Z')a[i] = 10+s[i]-'A';
if('a'<=s[i] and s[i]<='z')a[i] = 36+s[i]-'a';
if(s[i] == '{')a[i] = 63;
if(s[i] == '|')a[i] = 64;
}//cout << 111 << endl;
//for(int i = 1;i<=8;i++)a[i] = rand()%65;op = rand()%2;
// cout << op << endl;
if(op == 0){
for(int i =0;i<4;i++)x[i][calc(i)] = 1;
}else{
int ok = 1;
for(int i =0;i<4;i++)if(!x[i][calc(i)])ok = 0;
if(ok)putchar('1');else putchar('0');putchar('\n');
}
}
signed main(){srand(time(0));
mod[0] = 29998057;
mod[1] =29998061;
mod[2] = 29998063;
mod[3] =29998099;
int tot =0 ;/*
for(int i = 29998000;tot<=4;i++){
if(is_prime(i)){
tot++;cout << i << endl;
}
}*/
int t ;cin>>t;
while(t--){
solve();
}return 0;
}//
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 20
Accepted
time: 467ms
memory: 15856kb
input:
1000000 Uj5uBsJv 0 N4lZziLs 0 q{7xPpqw 0 bOwEi7xZ 0 uMi0XwMZ 0 YxOQyTvQ 0 pQPP{YPt 0 {9lJuwRe 0 m8Yf...
output:
0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 ...
result:
points 1.0 fpr = 0.00000000
Test #2:
score: 20
Accepted
time: 1123ms
memory: 15852kb
input:
2500000 C2xt2|rV 0 Ccxt2|rV 1 8T8ih4ZG 0 OrerrRpT 0 KM{oEOPC 0 Fz{5qrhy 0 Xr9JoADc 0 LbtQU6x7 1 h3nv...
output:
0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 1 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 ...
result:
points 1.0 fpr = 0.00000200
Test #3:
score: 20
Accepted
time: 1379ms
memory: 15856kb
input:
3000000 7CBcR7Ph 0 nVCSmjW9 0 7aSeOGGC 0 uL5M|6bS 0 o9x3eH9J 0 qIyVDtRm 0 K9i7OgsI 0 z22|Jct4 0 bjun...
output:
0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 1 ...
result:
points 1.0 fpr = 0.00001100
Test #4:
score: 20
Accepted
time: 1864ms
memory: 15856kb
input:
4000000 AeRYhnMh 0 fsRoVfHK 0 TFDQPoqg 0 e3QmG37V 0 weDg5Uab 0 C1ZaPegJ 0 W|QujCy8 0 oxIQcwRy 0 ZXWP...
output:
1 0 1 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 0 1 0 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 1 0 0 0 1 0 1 0 ...
result:
points 1.0 fpr = 0.00003900
Test #5:
score: 20
Accepted
time: 1834ms
memory: 15852kb
input:
4000000 QR1Ma{Gf 0 V{bJCBvU 0 yXTsvq5y 0 L0NoGuog 0 |eFdhqcn 0 d8SmYPx5 0 AJ9Aqcq2 0 hCcZ5jH6 0 SmmO...
output:
1 1 0 0 0 1 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 1 0 ...
result:
points 1.0 fpr = 0.00006400