mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
3942. [Usaco2015 Feb]Censoring
https://hydro.ac/d/bzoj/record/6322c3ee32ae6c3198cc6e69
This commit is contained in:
parent
9c13898a05
commit
39e04e9b16
51
BZOJ/3942/3942.cpp
Normal file
51
BZOJ/3942/3942.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 1e6 + 5;
|
||||
const int hash = 233333;
|
||||
|
||||
int cnt;
|
||||
char st[N];
|
||||
std::string s, t;
|
||||
unsigned long long p = 1, h[N], t_hash;
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> s >> t;
|
||||
|
||||
int n = s.size();
|
||||
int m = t.size();
|
||||
s = ' ' + s;
|
||||
|
||||
for (char c : t) {
|
||||
t_hash = t_hash * hash + c;
|
||||
p *= hash;
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
st[++cnt] = s[i];
|
||||
|
||||
h[cnt] = h[cnt - 1] * hash + s[i];
|
||||
|
||||
if (cnt >= m && h[cnt] - h[cnt - m] * p == t_hash) {
|
||||
cnt -= m;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i <= cnt; i++) {
|
||||
cout << st[i];
|
||||
}
|
||||
|
||||
cout << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
BZOJ/3942/data/1.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/1.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/10.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/10.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/11.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/11.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/12.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/12.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/13.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/13.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/14.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/14.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/15.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/15.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/2.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/2.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/3.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/3.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/4.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/4.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/5.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/5.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/6.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/6.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/7.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/7.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/8.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/8.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/9.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3942/data/9.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3942/data/9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user