QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#413381 | #7990. 广播 | XiaoMuchen | WA | 10ms | 19372kb | C++20 | 1.2kb | 2024-05-17 14:28:18 | 2024-05-17 14:28:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define lld long long int
#define ulld unsigned long long int
#define pii pair<int, int>
#define pll pair<lld, lld>
#define pff pair<double, double>
const int dinf = 1e9 + 10;
const lld ldinf = 1e18 + 10;
const int N = 2e3 + 10;
const int M = 998244353;
int n, m;
int a[N], b[N], dp[N][N];
void solve()
{
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int j = 1; j <= m; j++)
cin >> b[j];
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
{
if (a[i] == 1 || b[j] == 1 || a[i] == b[j])
dp[i][j] = dp[i - 1][j - 1];
else
dp[i][j] = min(dp[i - 1][j], dp[i][j - 1]) + 1;
}
cout << dp[n][m] << endl;
}
#define debug 0
int main()
{
#if debug
clock_t start = clock();
freopen("1.in", "r", stdin);
freopen("1.out", "w", stdout);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T = 1;
// cin >> T;
while (T--)
{
solve();
}
#if debug
cout << endl << "time: " << clock() - start << endl;
#endif
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3672kb
input:
4 2 2 1 3 2 4 2
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
1 1 2 3
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 3ms
memory: 19356kb
input:
1997 1970 1235 1225 1169 368 1 1 1444 1 1189 775 788 114 1609 1169 821 1708 821 1370 1444 1356 775 1747 1661 775 1692 1960 788 1866 382 1444 1356 1868 309 788 1609 211 1160 1225 1370 1609 1692 1064 1356 788 1707 775 1707 1064 1356 1160 1692 368 129 1235 1868 1370 1160 775 368 129 1747 334 1503 1444 ...
output:
1813
result:
ok single line: '1813'
Test #4:
score: 0
Accepted
time: 10ms
memory: 19316kb
input:
2000 1999 251 690 1357 1183 815 1939 1665 251 1070 354 783 1901 386 521 69 960 1 295 295 632 215 920 1763 69 1575 1246 1 1720 743 1192 959 830 595 1073 655 1763 301 632 518 319 1371 1844 768 501 400 1362 1533 1776 1319 241 178 1447 9 1339 1192 603 1 461 1113 396 1532 738 955 1005 835 690 430 495 119...
output:
1951
result:
ok single line: '1951'
Test #5:
score: 0
Accepted
time: 5ms
memory: 18940kb
input:
1953 1948 1468 1492 655 1311 777 954 579 1290 1778 630 1048 1026 1605 1522 1919 552 1813 1074 64 1586 30 1319 1612 1808 518 141 251 254 503 202 484 699 1518 290 856 1199 852 1421 1322 618 264 1921 1744 261 418 581 291 871 523 1783 410 1316 1040 599 1298 490 1738 1951 3 435 572 1465 566 167 182 1694 ...
output:
1920
result:
ok single line: '1920'
Test #6:
score: 0
Accepted
time: 0ms
memory: 18964kb
input:
1953 1944 615 1448 206 615 206 615 1941 1448 206 206 1316 1448 1448 1 1941 1448 615 615 1448 615 206 1448 615 206 1448 206 1941 1448 206 1941 206 1316 1316 1316 1316 1316 1941 615 615 615 1941 1316 1941 615 1941 1448 1316 1941 615 1448 1316 206 1316 615 1941 206 615 1941 206 615 206 1448 1448 615 13...
output:
1224
result:
ok single line: '1224'
Test #7:
score: 0
Accepted
time: 3ms
memory: 19308kb
input:
1996 1974 1538 421 1833 464 1912 925 1538 647 483 713 421 647 1912 1818 1547 451 925 713 173 647 1235 1269 1818 421 1818 616 1577 1833 26 1273 416 290 483 713 290 1818 1093 713 1 26 1912 1616 1912 416 1235 421 421 1063 290 1873 1063 1577 1563 26 1063 1 925 1235 616 464 1912 1833 1833 1251 483 483 12...
output:
1738
result:
ok single line: '1738'
Test #8:
score: 0
Accepted
time: 9ms
memory: 19324kb
input:
1993 1973 187 634 1429 792 1765 1464 303 1545 1318 1673 1960 203 175 106 290 1484 710 857 175 1438 5 143 1475 1967 1842 1476 1 947 842 1967 868 1 1736 1727 1 608 1934 1825 750 1864 518 336 1765 184 323 1913 262 141 1270 719 470 854 1474 1932 571 568 1484 1545 256 685 1565 601 1154 1082 1687 1 1393 1...
output:
1866
result:
ok single line: '1866'
Test #9:
score: -100
Wrong Answer
time: 4ms
memory: 19372kb
input:
1982 1987 553 461 320 85 1753 1329 1836 1036 861 1972 621 1377 265 564 387 229 340 1841 158 702 743 1020 1213 700 1196 159 713 396 1657 1356 529 826 1689 1739 1 998 1516 1597 879 1167 1 1385 299 315 1220 1279 315 1240 112 1194 1293 488 513 1596 1270 26 997 2000 1565 726 559 823 751 1132 564 287 1356...
output:
0
result:
wrong answer 1st lines differ - expected: '1863', found: '0'