# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
690260 | 2023-01-30T05:28:28 Z | moonhero | Round words (IZhO13_rowords) | C++14 | 13 ms | 11820 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 2e3 + 5; int dp[N][N]; int main () { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string a, b; cin >> a >> b; sort(a.begin(), a.end()); sort(b.begin(), b.end()); for (int i = 1; i <= a.size(); i++) { for (int j = 1; j <= b.size(); j++) { dp[i][j] = 0; } } for (int i = 1; i <= a.size(); i++) { for (int j = 1; j <= b.size(); j++) { if (a[i - 1] == b[j - 1]) { dp[i][j] = 1 + dp[i - 1][j - 1]; } dp[i][j] = max({dp[i][j - 1], dp[i - 1][j], dp[i][j], dp[i - 1][j - 1]}); } } cout << dp[a.size()][b.size()]; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 468 KB | Output is correct |
5 | Incorrect | 0 ms | 468 KB | Output isn't correct |
6 | Correct | 3 ms | 4684 KB | Output is correct |
7 | Correct | 12 ms | 8148 KB | Output is correct |
8 | Incorrect | 10 ms | 8148 KB | Output isn't correct |
9 | Incorrect | 10 ms | 8148 KB | Output isn't correct |
10 | Incorrect | 9 ms | 8136 KB | Output isn't correct |
11 | Incorrect | 11 ms | 8964 KB | Output isn't correct |
12 | Correct | 13 ms | 9684 KB | Output is correct |
13 | Incorrect | 11 ms | 9684 KB | Output isn't correct |
14 | Incorrect | 10 ms | 9172 KB | Output isn't correct |
15 | Incorrect | 12 ms | 9944 KB | Output isn't correct |
16 | Incorrect | 10 ms | 8800 KB | Output isn't correct |
17 | Incorrect | 8 ms | 9300 KB | Output isn't correct |
18 | Incorrect | 12 ms | 11348 KB | Output isn't correct |
19 | Incorrect | 9 ms | 8176 KB | Output isn't correct |
20 | Incorrect | 11 ms | 10196 KB | Output isn't correct |
21 | Incorrect | 5 ms | 8128 KB | Output isn't correct |
22 | Incorrect | 7 ms | 9300 KB | Output isn't correct |
23 | Incorrect | 7 ms | 9940 KB | Output isn't correct |
24 | Incorrect | 8 ms | 10556 KB | Output isn't correct |
25 | Incorrect | 10 ms | 11820 KB | Output isn't correct |