# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
40028 | 2018-01-25T11:52:00 Z | funcsr | 구간 성분 (KOI15_interval) | C++14 | 1000 ms | 48848 KB |
#include <cstdio> #include <iostream> #include <algorithm> #include <string> #include <cstring> #include <vector> #include <queue> #include <set> #include <map> #include <cmath> #include <iomanip> #include <cassert> #include <bitset> using namespace std; typedef pair<int, int> P; #define rep(i, n) for (int i=0; i<(n); i++) #define all(c) (c).begin(), (c).end() #define uniq(c) c.erase(unique(all(c)), (c).end()) #define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin()) #define _1 first #define _2 second #define pb push_back #define INF 1145141919 #define MOD 1000000009 const int B = 321; string S, T; set<int> mp[1501]; int pB[26]; signed main() { ios::sync_with_stdio(false); cin.tie(0); pB[0] = 1; for (int i=1; i<26; i++) pB[i] = (1LL*B*pB[i-1]) % MOD; cin >> S >> T; rep(l, S.size()) { int cnt = 0; for (int r=l; r<S.size(); r++) { cnt = (cnt + pB[S[r]-'a']) % MOD; mp[r-l+1].insert(cnt); } } int m = 0; rep(l, T.size()) { int cnt = 0; for (int r=l; r<T.size(); r++) { cnt = (cnt + pB[T[r]-'a']) % MOD; if (mp[r-l+1].find(cnt) != mp[r-l+1].end()) m = max(m, r-l+1); } } cout << m << "\n"; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2252 KB | Output is correct |
2 | Correct | 0 ms | 2252 KB | Output is correct |
3 | Correct | 1 ms | 2252 KB | Output is correct |
4 | Correct | 1 ms | 2384 KB | Output is correct |
5 | Correct | 2 ms | 2384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 5816 KB | Output is correct |
2 | Correct | 44 ms | 6740 KB | Output is correct |
3 | Correct | 6 ms | 2384 KB | Output is correct |
4 | Correct | 2 ms | 2252 KB | Output is correct |
5 | Correct | 57 ms | 7532 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 447 ms | 23768 KB | Output is correct |
2 | Incorrect | 515 ms | 24560 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 207 ms | 10700 KB | Output is correct |
2 | Execution timed out | 1000 ms | 48848 KB | Execution timed out |
3 | Halted | 0 ms | 0 KB | - |