| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 38440 | kajebiii | 구간 성분 (KOI15_interval) | C++14 | 1000 ms | 2020 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<int, int> pi;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;
const int MAX_N = 2e3 + 10;
typedef unsigned int ui;
int N, M; char Ns[MAX_N], Ms[MAX_N];
ui H[26];
int main() {
H[0] = 1e9 + 7;
for(int i=1; i<26; i++) H[i] = H[i-1] * (ui)97 + (ui)(1e8 + 7);
scanf("%s", Ns); N = strlen(Ns);
scanf("%s", Ms); M = strlen(Ms);
int ans = 0;
for(int l=min(N, M); l>=1; l--) {
ui n = 0, bm = 0;
for(int i=0; i<l-1; i++) n += H[Ns[i]-'a'], bm += H[Ms[i]-'a'];
for(int i=l-1; i<N; i++) {
n += H[Ns[i]-'a'];
if(i-l>=0) n -= H[Ns[i-l]-'a'];
ui m = bm;
for(int j=l-1; j<M; j++) {
m += H[Ms[j]-'a'];
if(j-l>=0) m -= H[Ms[j-l]-'a'];
if(n == m) {
ans = l;
goto finish;
}
}
}
}
finish:
printf("%d\n", ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
