# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
153078 | admin | 원형 문자열 (IZhO13_rowords) | C++14 | 186 ms | 504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define get(arr, x) (((arr[x >> 6] >> (x & 63)) & 1) == 1)
#define set(arr, x) (arr[x >> 6] |= 1llu << (x & 63))
using ulint = unsigned long long;
int lcs(std::string A, std::string B) {
int N = A.size(), M = B.size();
int sz = (M >> 6) + 1;
std::vector<ulint> S[256];
for(int c = 0; c < 256; c++) S[c].resize(sz);
for(int j = 0; j < M; j++) set(S[B[j]], j);
std::vector<ulint> row(sz);
for(int j = 0; j < M; j++) if(A[0] == B[j]) { set(row, j); break; }
for(int i = 1; i < N; i++) {
ulint shl_carry = 1;
ulint minus_carry = 0;
for(int k = 0; k < sz; k++) {
// Compute k-th block of x == S[A[i]] OR M[i-1]
ulint x_k = S[A[i]][k] | row[k];
// Compute k-th block of "(M[i-1] << 1) | 1"
ulint term_1 = (row[k] << 1) | shl_carry;
shl_carry = row[k] >> 63;
// Compute k-th block of "x - ((M[i-1] << 1) | 1)"
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |