# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
58004 |
2018-07-16T15:35:27 Z |
gs18115 |
구간 성분 (KOI15_interval) |
C++14 |
|
129 ms |
752 KB |
#include<iostream>
#include<set>
using namespace std;
typedef long long LL;
set<LL>S;
char A[9999],B[9999];
LL Al,Bl,i,j,k;
LL H[30]={7788865336992840,
3982888009495742,
2836910121684992,
3522112993845513,
4732605011553192,
8449882544766916,
8742803940476960,
4363828159585175,
7473836210442302,
4361127542297857,
4519955382410467,
6588062529655092,
9580539184860668,
9266654392232720,
6045065109616561,
1453148769925218,
5946433626154357,
6409474294640593,
1502390741210612,
2054099452893326,
8795091736658145,
9396219785890560,
242742419513769,
3840645950087632,
2664761740375372,
6306788660504860};
int main()
{
for(i=25,k=1;i>=0;i--,k*=(i+1))
H[i]=k;
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>A>>B;
for(Al=0;A[Al];Al++);
for(Bl=0;B[Bl];Bl++);
for(i=min(Al,Bl);i>0;i--)
{
S.clear();
k=0;
for(j=0;j<i;j++)
k+=H[A[j]-97];
S.insert(k);
for(j=0;j<Al-i;j++)
{
k+=H[A[j+i]-97]-H[A[j]-97];
S.insert(k);
}
k=0;
for(j=0;j<i;j++)
k+=H[B[j]-97];
if(S.find(k)!=S.end())
{
cout<<i<<endl;
return 0;
}
for(j=0;j<Bl-i;j++)
{
k+=H[B[j+i]-97]-H[B[j]-97];
if(S.find(k)!=S.end())
{
cout<<i<<endl;
return 0;
}
}
}
cout<<0<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
436 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
101 ms |
488 KB |
Output is correct |
2 |
Correct |
129 ms |
616 KB |
Output is correct |
3 |
Correct |
118 ms |
676 KB |
Output is correct |
4 |
Incorrect |
114 ms |
752 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
752 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |