ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#182634 | #95. cycle | mH | 0 | 4458ms | 31192kb | C++11 | 992b | 2023-08-07 11:20:40 | 2023-08-07 11:20:44 |
answer
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
bitset<9000> vis1[9000], vis2[9000], vis3[9000];
int l, r, ans, a[10005];
inline 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: 670ms
memory: 31192kb
input:
50 760 33 17 -548407 -167520 43 34 -701513 -760054 44 46 -698238 -697504 17 35 -473206 -17431 24 13 ...
output:
1242881
result:
wrong answer 1st lines differ - expected: '6', found: '1242881'
Test #2:
score: 0
Wrong Answer
time: 799ms
memory: 31192kb
input:
50 23 9 26 88 -971968 13 21 -119037 -633102 28 23 -486087 -443177 21 10 20 -560419 9 35 -962231 -857...
output:
1242881
result:
wrong answer 1st lines differ - expected: '0', found: '1242881'
Test #3:
score: 0
Time Limit Exceeded
input:
100 829 16 68 -169807 -418570 59 90 -285181 -523034 76 30 68 -822178 10 1 -600250 -98762 63 75 -7427...
output:
result:
Test #4:
score: 0
Time Limit Exceeded
input:
7 21 1 2 -91 -94 1 3 4 -96 1 4 -98 -100 1 5 -91 -98 1 6 -97 -29 1 7 -98 -91 2 3 -99 -98 2 4 6 -90 2 ...
output:
result:
Test #5:
score: 0
Wrong Answer
time: 673ms
memory: 31192kb
input:
100 4481 32 95 -499665 -546421 2 37 -717568 -488401 65 46 -731695 97 18 70 -623180 -889223 66 76 -66...
output:
1242881
result:
wrong answer 1st lines differ - expected: '3', found: '1242881'
Test #6:
score: 0
Wrong Answer
time: 698ms
memory: 31188kb
input:
300 44603 194 10 -185995 -228575 88 112 -373810 -140242 127 198 -269962 -767418 202 116 -831356 -381...
output:
1242881
result:
wrong answer 1st lines differ - expected: '3', found: '1242881'
Test #7:
score: 0
Time Limit Exceeded
input:
300 759 240 232 1 -188898 150 151 -620634 -346228 52 42 -648311 -981185 141 3 -136275 -326941 165 17...
output:
result:
Test #8:
score: 0
Time Limit Exceeded
input:
300 40148 251 131 -929677 -822098 61 32 -503888 -216163 294 75 -516984 -536981 39 58 3 -816887 251 5...
output:
result:
Test #9:
score: 0
Wrong Answer
time: 914ms
memory: 31192kb
input:
300 26880 229 288 -429005 -318473 212 99 -700324 -697321 260 58 -427033 -917434 269 44 -403330 -3139...
output:
1242881
result:
wrong answer 1st lines differ - expected: '3', found: '1242881'
Test #10:
score: 0
Wrong Answer
time: 704ms
memory: 31188kb
input:
300 15511 189 295 -441963 -96683 141 9 -871841 -255420 37 155 -40656 -817740 60 182 -146664 -801258 ...
output:
1242881
result:
wrong answer 1st lines differ - expected: '3', found: '1242881'