Submission #18466

# Submission time Handle Problem Language Result Execution time Memory
18466 2016-02-05T07:28:50 Z eaststar 구간 성분 (KOI15_interval) C++14
100 / 100
516 ms 1716 KB
#include <stdio.h>
#include <string.h>
#include <set>
#include <vector>
using namespace std;
vector<int> t(26);
set<vector<int> > s;
char a[1510],b[1510];
int main(){
    int i,j,n,m;
    scanf("%s\n%s",a,b);
    n=strlen(a);
    m=strlen(b);
    for(i=min(n,m);i;--i){
        for(j=0;j<26;++j)t[j]=0;
        for(j=0;j<i-1;++j)++t[a[j]-97];
        for(j=i-1;j<n;++j){
            ++t[a[j]-97];
            s.insert(t);
            --t[a[j-i+1]-97];
        }
        for(j=0;j<26;++j)t[j]=0;
        for(j=0;j<i-1;++j)++t[b[j]-97];
        for(j=i-1;j<m;++j){
            ++t[b[j]-97];
            if(s.find(t)!=s.end()){
                printf("%d",i);
                return 0;
            }
            --t[b[j-i+1]-97];
        }
        s.clear();
    }
    puts("0");
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1584 KB Output is correct
2 Correct 0 ms 1584 KB Output is correct
3 Correct 0 ms 1584 KB Output is correct
4 Correct 2 ms 1584 KB Output is correct
5 Correct 0 ms 1584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 1584 KB Output is correct
2 Correct 29 ms 1584 KB Output is correct
3 Correct 0 ms 1584 KB Output is correct
4 Correct 0 ms 1584 KB Output is correct
5 Correct 50 ms 1584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 209 ms 1716 KB Output is correct
2 Correct 229 ms 1716 KB Output is correct
3 Correct 220 ms 1716 KB Output is correct
4 Correct 214 ms 1716 KB Output is correct
5 Correct 222 ms 1716 KB Output is correct
6 Correct 217 ms 1716 KB Output is correct
7 Correct 220 ms 1716 KB Output is correct
8 Correct 215 ms 1716 KB Output is correct
9 Correct 224 ms 1716 KB Output is correct
10 Correct 222 ms 1716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 1584 KB Output is correct
2 Correct 417 ms 1716 KB Output is correct
3 Correct 363 ms 1716 KB Output is correct
4 Correct 13 ms 1584 KB Output is correct
5 Correct 516 ms 1716 KB Output is correct