UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#182622#228. bookmH04603ms38268kbC++11991b2023-08-07 11:16:282023-08-07 11:16:29

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];
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);
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 0
Wrong Answer
time: 719ms
memory: 38268kb

input:

100 2 28 9426 9827
----+--+-++++-+++--+---+++------+---------++----+-++++-+--+++-++++++-+-+--+++--++...

output:

1242881

result:

wrong answer 1st lines differ - expected: '179094', found: '1242881'

Test #2:

score: 0
Wrong Answer
time: 815ms
memory: 38268kb

input:

100 6 68 8136 6688
+++-+---+----+--+-++--+---++++++--+-++-++--+--++--+-++---+++-+++---++++-+++-+++++...

output:

1242881

result:

wrong answer 1st lines differ - expected: '219672', found: '1242881'

Test #3:

score: 0
Wrong Answer
time: 740ms
memory: 38264kb

input:

100 4 0 7368 5364
-+-++---+--+-+-+-++++++++-+-++++--+-+---++---++--+++----+--+-----------+--+--+++--...

output:

1242881

result:

wrong answer 1st lines differ - expected: '36840', found: '1242881'

Test #4:

score: 0
Time Limit Exceeded

input:

1000 454 0 10 10000000
--+++++-+---++-++-+-++++-+--+---++++++++-+-++-+-+-+--+++--+----+--++++-++---+...

output:


result:


Test #5:

score: 0
Wrong Answer
time: 699ms
memory: 38260kb

input:

1000 376 1144 440675445 812725011
++++-+------++---++---+--+++---++++--++--+-++++-+---++++-+++-+-+--...

output:

1242881

result:

wrong answer 1st lines differ - expected: '158643160200', found: '1242881'

Test #6:

score: 0
Wrong Answer
time: 749ms
memory: 38260kb

input:

1000 276 18 938498793 701159019
-+++---+++-+---+++---+-+----+++-+-+-++---+--+++++-+---+-++-+----++++...

output:

1242881

result:

wrong answer 1st lines differ - expected: '95726876886', found: '1242881'

Test #7:

score: 0
Time Limit Exceeded

input:

100000 67360 94034 10 10000000
---+++-++-+++---+-+--+-+------+-+---+----+----+-----+-+--+----+++-+--...

output:


result:


Test #8:

score: 0
Time Limit Exceeded

input:

100000 57247 91 752278539 881719015
-+++++--+--++---+-----++-+-+++++-+-+--+-----++--+++++-+--+-+++-+...

output:


result:


Test #9:

score: 0
Wrong Answer
time: 881ms
memory: 38264kb

input:

1000000 897028 186010 944612613 866641998
+---+-++++--+---+---+----++--+-+---++---+-+++++++--+++-+--...

output:

1242881

result:

wrong answer 1st lines differ - expected: '335957143489128', found: '1242881'

Test #10:

score: 0
Time Limit Exceeded

input:

1000000 524180 1009530 659936979 574325878
++---++--+-++-+---+---+-++--+-++--+----++---+-++-+-+-++-+...

output:


result: