标签:can iii fit acm 代码 cer eset double pll
Regular Number
思路:
shifit and算法
代码:
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize(4)
#include<bits/stdc++.h>
using namespace std;
#define y1 y11
#define fi first
#define se second
#define pi acos(-1.0)
#define LL long long
//#define mp make_pair
#define pb push_back
#define ls rt<<1, l, m
#define rs rt<<1|1, m+1, r
#define ULL unsigned LL
#define pll pair<LL, LL>
#define pli pair<LL, int>
#define pii pair<int, int>
#define piii pair<pii, int>
#define pdd pair<double, double>
#define mem(a, b) memset(a, b, sizeof(a))
#define debug(x) cerr << #x << " = " << x << "\n";
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//head
const int N = 1000 + 10, M = 5e6 + 10;
char s[M];
bitset<N> f[10], g;
int t, x, n;
int main() {
while(~scanf("%d", &n)) {
for (int i = 0; i < 10; ++i) f[i].reset();
g.reset();
for (int i = 0; i < n; ++i) {
scanf("%d", &t);
while(t--){
scanf("%d", &x);
f[x].set(i);
}
}
scanf("%s", s);
int l = strlen(s);
for (int i = 0; i < l; ++i) {
g = g<<1;
g.set(0);
g &= f[s[i]-'0'];
if(g[n-1]) {
char tmp = s[i+1];
s[i+1] = '\0';
puts(s+i+1-n);
s[i+1] = tmp;
}
}
}
return 0;
}
标签:can iii fit acm 代码 cer eset double pll
原文地址:https://www.cnblogs.com/widsom/p/11668025.html