UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#182628#228. bookmH06125ms38268kbC++112.9kb2023-08-07 11:17:362023-08-07 11:17:38

answer

#pragma GCC diagnostic error "-std=c++11"
#pragma GCC target("avx")
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#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);
}

Details

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

Test #1:

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

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: 693ms
memory: 38260kb

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: 889ms
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: 854ms
memory: 38264kb

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: 703ms
memory: 38264kb

input:

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

output:

1242881

result:

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

Test #7:

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

input:

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

output:

1242881

result:

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

Test #8:

score: 0
Time Limit Exceeded

input:

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

output:


result:


Test #9:

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

input:

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

output:

1242881

result:

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

Test #10:

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

input:

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

output:

1242881

result:

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