Submission #51641

# Submission time Handle Problem Language Result Execution time Memory
51641 2018-06-19T13:30:41 Z okaybody10 구간 성분 (KOI15_interval) C++
61 / 100
1000 ms 172064 KB
#include <iostream>
#include <vector>
#include <set>
using namespace std;
typedef vector<int> vi;
set<vi> gg;
int main()
{
    cin.tie(NULL); ios::sync_with_stdio(false);
    string s1,s2; cin>>s1>>s2;
    int l1=s1.size(),l2=s2.size();
    for(int i=l1;i>0;i--)
    {
        vi alpha(26);
        int s=0,e=i-1;
        for(int j=s;j<=e;j++) alpha[s1[j]-'a']++;
        while(e<l1)
        {
            gg.insert(alpha);
            if(++e<l1) alpha[s1[e]-'a']++,alpha[s1[s++]-'a']--;
        }
    }
    for(int i=l2;i>0;i--)
    {
        vi alpha(26);
        int s=0,e=i-1;
        for(int j=s;j<=e;j++) alpha[s2[j]-'a']++;
        while(e<l2)
        {
            if(gg.count(alpha)) { cout<<i; return 0;}
            if(++e<l2) alpha[s2[e]-'a']++,alpha[s2[s++]-'a']--;
        }
    }
    cout<<0;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 3 ms 612 KB Output is correct
3 Correct 2 ms 612 KB Output is correct
4 Correct 6 ms 1196 KB Output is correct
5 Correct 5 ms 1196 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 78 ms 13640 KB Output is correct
2 Correct 82 ms 17032 KB Output is correct
3 Correct 19 ms 17032 KB Output is correct
4 Correct 13 ms 17032 KB Output is correct
5 Correct 108 ms 20028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 485 ms 79684 KB Output is correct
2 Correct 543 ms 82540 KB Output is correct
3 Correct 473 ms 82540 KB Output is correct
4 Correct 517 ms 82540 KB Output is correct
5 Correct 470 ms 82540 KB Output is correct
6 Correct 474 ms 82540 KB Output is correct
7 Correct 522 ms 82540 KB Output is correct
8 Correct 478 ms 82832 KB Output is correct
9 Correct 480 ms 82832 KB Output is correct
10 Correct 504 ms 82832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 237 ms 82832 KB Output is correct
2 Execution timed out 1058 ms 172064 KB Time limit exceeded
3 Halted 0 ms 0 KB -