Submission #51640

# Submission time Handle Problem Language Result Execution time Memory
51640 2018-06-19T13:29:16 Z okaybody10 구간 성분 (KOI15_interval) C++
61 / 100
1000 ms 172020 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.find(alpha)!=gg.end()) { 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 376 KB Output is correct
2 Correct 2 ms 616 KB Output is correct
3 Correct 2 ms 616 KB Output is correct
4 Correct 5 ms 1212 KB Output is correct
5 Correct 5 ms 1240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 13708 KB Output is correct
2 Correct 88 ms 17212 KB Output is correct
3 Correct 19 ms 17212 KB Output is correct
4 Correct 21 ms 17212 KB Output is correct
5 Correct 112 ms 19924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 478 ms 79656 KB Output is correct
2 Correct 511 ms 82572 KB Output is correct
3 Correct 504 ms 82572 KB Output is correct
4 Correct 510 ms 82572 KB Output is correct
5 Correct 528 ms 82572 KB Output is correct
6 Correct 474 ms 82572 KB Output is correct
7 Correct 495 ms 82572 KB Output is correct
8 Correct 523 ms 82796 KB Output is correct
9 Correct 494 ms 82796 KB Output is correct
10 Correct 517 ms 82796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 295 ms 82796 KB Output is correct
2 Execution timed out 1052 ms 172020 KB Time limit exceeded
3 Halted 0 ms 0 KB -