# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
71120 | 2018-08-24T07:06:30 Z | 3zp | 구간 성분 (KOI15_interval) | C++14 | 1000 ms | 46064 KB |
#include<bits/stdc++.h> using namespace std; int A = 987654323; int B = 1e9 + 9; int pol[26]; set<int> sa[1509]; main(){ pol[0] = 1; for(int i = 1; i < 26; i ++) pol[i] = (long long)pol[i - 1] * (long long)A % B; int n, m; string a, b; cin >> a >> b; n = a.size(), m = b.size(); for(int i = 0; i < n; i++){ long long H = 0; for(int j = i; j < n; j++){ H += pol[a[j] - 'a']; if(H > B) H -= B; sa[j - i + 1].insert(H); } } int ans = 0; for(int i = 0; i < m; i++){ long long H = 0; for(int j = i; j < m; j++){ H += pol[b[j] - 'a']; if(H > B) H -= B; if(sa[j - i + 1].find(H) != sa[j - i + 1].end()){ ans = max(ans, j - i + 1); } } } cout << ans << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 484 KB | Output is correct |
3 | Correct | 3 ms | 484 KB | Output is correct |
4 | Correct | 5 ms | 684 KB | Output is correct |
5 | Correct | 4 ms | 684 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 61 ms | 4004 KB | Output is correct |
2 | Correct | 79 ms | 4952 KB | Output is correct |
3 | Correct | 10 ms | 4952 KB | Output is correct |
4 | Correct | 4 ms | 4952 KB | Output is correct |
5 | Correct | 91 ms | 5864 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 762 ms | 22180 KB | Output is correct |
2 | Incorrect | 837 ms | 23008 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 277 ms | 23008 KB | Output is correct |
2 | Execution timed out | 1073 ms | 46064 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |