ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#182609 | #42. queen | mH | 0 | 3924ms | 38264kb | C++11 | 984b | 2023-08-07 11:12:51 | 2023-08-07 11:12:53 |
answer
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
bitset<10005> vis1[10005], vis2[10005], vis3[10005];
int l, r, ans, a[10005];
bool dfs(int x, int y)
{
if (vis3[x][y])
return 1;
if (vis2[x][y])
return vis1[x][y];
if (!x || !y)
return 0;
vis2[x][y] = vis3[x][y] = 1;
int x1 = x, y1 = y;
if (x < y)
x = a[x];
else
y = a[y];
if (x < y)
y -= x;
else
x -= y;
vis1[x1][y1] = dfs(x, y);
vis3[x1][y1] = 0;
return vis1[x1][y1];
}
signed main()
{
#ifndef ONLINE_JUDGE
freopen("data/data.in", "r", stdin);
// freopen("data/data.out", "w", stdout);
#endif
std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
for (int i = 1; i < 10000; i++)
{
string s = to_string(i);
reverse(s.begin(), s.end());
a[i] = stoi(s);
}
l=5000,r=5000;
for (int i = 1; i <= l; i++)
for (int j = 1; j <= r; j++)
ans += dfs(i, j);
cout << ans;
exit(0);
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
time: 766ms
memory: 38264kb
input:
10 10 3 4 4 5 10 9 4 2 5 5 3 1 8 9 3 3 2 5 2 6
output:
1242881
result:
wrong answer 1st lines differ - expected: '0 2 3 3 1 1 0 0 0', found: '1242881'
Test #2:
score: 0
Time Limit Exceeded
input:
900 900 503 575 536 735 97 767 131 791 188 113 363 502 247 825 264 842 438 893 599 314 348 274 574 6...
output:
result:
Test #3:
score: 0
Time Limit Exceeded
input:
1000 1000 23 676 835 868 253 639 489 773 106 384 628 585 863 502 789 471 964 251 967 630 5 75 750 16...
output:
result:
Test #4:
score: 0
Wrong Answer
time: 804ms
memory: 38264kb
input:
100000 500 78494 97550 83510 81587 95499 87612 84636 74826 75513 95815 67640 68373 83551 77889 69117...
output:
1242881
result:
wrong answer 1st lines differ - expected: '480 18 2 0 0 0 0 0 0', found: '1242881'
Test #5:
score: 0
Wrong Answer
time: 836ms
memory: 38264kb
input:
100000 750 23890 2611 15946 9023 304 26283 3001 13845 18144 26822 1752 24381 8020 25573 28483 19123 ...
output:
1242881
result:
wrong answer 1st lines differ - expected: '685 60 5 0 0 0 0 0 0', found: '1242881'
Test #6:
score: 0
Time Limit Exceeded
input:
100000 1000 8960 2686 12346 26683 25083 1374 1210 19895 7811 13373 2765 20979 28138 10479 1275 5254 ...
output:
result:
Test #7:
score: 0
Time Limit Exceeded
input:
70000 100000 67449 59032 56582 61809 65627 45023 54832 54881 63697 67627 49930 66219 42393 54328 458...
output:
result:
Test #8:
score: 0
Wrong Answer
time: 688ms
memory: 38260kb
input:
80000 100000 65069 68649 69222 78853 74951 60634 79644 61172 72125 79083 54777 60756 49785 62752 589...
output:
1242881
result:
wrong answer 1st lines differ - expected: '7 176 2218 12078 23794 27778 20650 10564 2735', found: '1...
Test #9:
score: 0
Wrong Answer
time: 830ms
memory: 38264kb
input:
90000 100000 67457 78587 80771 77113 75880 71265 79726 77572 67867 70275 63940 73566 73084 78097 671...
output:
1242881
result:
wrong answer 1st lines differ - expected: '4 165 2266 12172 23771 27754 20391 10657 2820', found: '1...
Test #10:
score: 0
Time Limit Exceeded
input:
100000 100000 82685 88489 89768 75476 99150 99508 79240 92502 98469 76447 72619 88003 78215 79291 81...