# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
71145 | khohko | 구간 성분 (KOI15_interval) | C++17 | 1083 ms | 43652 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define pb push_back
#define fr first
#define sc second
#define MAX ((ll)(1e12+100))
#define MX ((ll)(1e6+100))
#define ARRS ((ll)(2e6+100))
#define HS ((ll)(1049))
#define MOD ((ll)(1000000861))
#define EP ((double)(1e-9))
#define LG 21
#define mul(a,b) a=((a)*(b))%MOD
using namespace std;
string s,t;
ll pw[50][2000];
unordered_set<int> mp[2000];
ll ct[50];
int main(){
#ifdef KHOKHO
freopen("in.in","r",stdin);
freopen("out.out","w",stdout);
#endif
cin>>s>>t;
for(int i=0; i<40; i++)
for(int j=0; j<1600; j++)
pw[i][j]=(((ll)rand()<<48ll)+((ll)rand()<<32ll)+((ll)rand()<<16ll)+(ll)rand());
int pas=0;
for(int i=0; i<s.size(); i++){
ll hs=0;
for(int i=0; i<40; i++)ct[i]=0;
for(int j=i; j<s.size(); j++){
hs^=pw[s[j]-'a'][ct[s[j]-'a']++];
mp[j-i].insert(hs);
// mp[hs]=j-i+1;
}
}
for(int i=0; i<t.size(); i++){
ll hs=0;
for(int i=0; i<40; i++)ct[i]=0;
for(int j=i; j<t.size(); j++){
hs^=pw[t[j]-'a'][ct[t[j]-'a']++];
if(mp[j-i].find(hs)!=mp[j-i].end())
pas=max(pas,j-i+1);
}
}
cout<<pas;
}
컴파일 시 표준 에러 (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... |