QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#493377 | #9158. 分数 | LinkWish# | 0 | 136ms | 14388kb | C++14 | 1.1kb | 2024-07-27 08:40:10 | 2024-07-27 08:40:11 |
Judging History
answer
//Linkwish's code
#include<bits/stdc++.h>
#define endl '\n'
#define si static inline
#define mp make_pair
#define fi first
#define se second
using namespace std;typedef long long ll;typedef __int128 li;
typedef pair<int,int> pii;typedef pair<ll,ll> pll;typedef const int ci;
typedef const ll cl;const int iinf=INT_MAX;const ll linf=LLONG_MAX;
template<typename T>si bool gmax(T &x,const T y){if(x<y)return x=y,1;return 0;}
template<typename T>si bool gmin(T &x,const T y){if(y<x)return x=y,1;return 0;}
namespace LinkWish{
int n,m;
set<pii> p;
void dfs(int x,int y){
int g=__gcd(x,y);
x/=g,y/=g;
if(x>max(n,m)||y>max(n,m))return ;
if(p.count(pii(x,y)))return ;
p.emplace(x,y);
dfs(y,x);//1/x
if(x>2*y)dfs(x-2*y,y);//x-2
dfs(x+2*y,y);//x+2
}
void mian(){
cin>>n>>m;
if(n>8000||m>8000)return ;
dfs(1,2);
cout<<p.size()<<endl;
for(pii i:p)cout<<i.fi<<' '<<i.se<<endl;
}
}
signed main(){
#ifndef ONLINE_JUDGE
freopen("in.in","r",stdin);
freopen("out.out","w",stdout);
#endif
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
LinkWish::mian();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 1ms
memory: 3696kb
input:
99 99
output:
406 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 2 1 2 5 2 9 2 13 2 17 2 21 2 25 2 29 2 33 2 37 2 41 2 4...
result:
wrong answer Output contains longer sequence [length = 813], but answer contains 1 elements
Pretest #2:
score: 0
Wrong Answer
time: 0ms
memory: 3584kb
input:
98 97
output:
406 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 2 1 2 5 2 9 2 13 2 17 2 21 2 25 2 29 2 33 2 37 2 41 2 4...
result:
wrong answer 1st numbers differ - expected: '405', found: '406'
Pretest #3:
score: 0
Wrong Answer
time: 1ms
memory: 3644kb
input:
99 96
output:
406 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 2 1 2 5 2 9 2 13 2 17 2 21 2 25 2 29 2 33 2 37 2 41 2 4...
result:
wrong answer 1st numbers differ - expected: '396', found: '406'
Pretest #4:
score: 0
Wrong Answer
time: 5ms
memory: 4092kb
input:
995 977
output:
11304 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 116...
result:
wrong answer 1st numbers differ - expected: '11153', found: '11304'
Pretest #5:
score: 0
Wrong Answer
time: 5ms
memory: 4244kb
input:
991 990
output:
11220 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 116...
result:
wrong answer Output contains longer sequence [length = 22441], but answer contains 1 elements
Pretest #6:
score: 0
Wrong Answer
time: 5ms
memory: 4160kb
input:
976 968
output:
10974 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 116...
result:
wrong answer 1st numbers differ - expected: '10900', found: '10974'
Pretest #7:
score: 0
Wrong Answer
time: 133ms
memory: 14084kb
input:
7602 7864
output:
220906 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 11...
result:
wrong answer 1st numbers differ - expected: '215706', found: '220906'
Pretest #8:
score: 0
Wrong Answer
time: 136ms
memory: 14264kb
input:
7959 7735
output:
224740 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 11...
result:
wrong answer 1st numbers differ - expected: '220256', found: '224740'
Pretest #9:
score: 0
Wrong Answer
time: 129ms
memory: 14180kb
input:
7878 7863
output:
221472 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 11...
result:
wrong answer 1st numbers differ - expected: '221162', found: '221472'
Pretest #10:
score: 0
Wrong Answer
time: 127ms
memory: 14084kb
input:
7788 7658
output:
217874 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 11...
result:
wrong answer 1st numbers differ - expected: '215323', found: '217874'
Pretest #11:
score: 0
Wrong Answer
time: 0ms
memory: 3704kb
input:
95399 99767
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Pretest #12:
score: 0
Wrong Answer
time: 0ms
memory: 3552kb
input:
98051 99642
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Pretest #13:
score: 0
Wrong Answer
time: 0ms
memory: 3544kb
input:
95624 96007
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Pretest #14:
score: 0
Wrong Answer
time: 0ms
memory: 3540kb
input:
99208 98047
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Pretest #15:
score: 0
Wrong Answer
time: 0ms
memory: 3556kb
input:
997417 967722
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Pretest #16:
score: 0
Wrong Answer
time: 0ms
memory: 3644kb
input:
987807 956529
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Pretest #17:
score: 0
Wrong Answer
time: 0ms
memory: 3548kb
input:
971654 984345
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Pretest #18:
score: 0
Wrong Answer
time: 0ms
memory: 3704kb
input:
7892259 7983727
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Pretest #19:
score: 0
Wrong Answer
time: 0ms
memory: 3700kb
input:
7937869 29796968
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Pretest #20:
score: 0
Wrong Answer
time: 0ms
memory: 3616kb
input:
29717543 29510173
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Final Tests
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3636kb
input:
96 98
output:
406 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 2 1 2 5 2 9 2 13 2 17 2 21 2 25 2 29 2 33 2 37 2 41 2 4...
result:
wrong answer 1st numbers differ - expected: '396', found: '406'
Test #2:
score: 0
Wrong Answer
time: 1ms
memory: 3624kb
input:
100 99
output:
410 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 2 1 2 5 2 9 2 13 2 17 2 21 2 25 2 29 2 33 2 37 2 ...
result:
wrong answer 1st numbers differ - expected: '408', found: '410'
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3656kb
input:
99 99
output:
406 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 2 1 2 5 2 9 2 13 2 17 2 21 2 25 2 29 2 33 2 37 2 41 2 4...
result:
wrong answer Output contains longer sequence [length = 813], but answer contains 1 elements
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 4160kb
input:
963 951
output:
10734 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 116...
result:
wrong answer 1st numbers differ - expected: '10634', found: '10734'
Test #5:
score: 0
Wrong Answer
time: 5ms
memory: 4168kb
input:
958 974
output:
10948 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 116...
result:
wrong answer 1st numbers differ - expected: '10795', found: '10948'
Test #6:
score: 0
Wrong Answer
time: 5ms
memory: 4100kb
input:
966 990
output:
11220 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 116...
result:
wrong answer 1st numbers differ - expected: '11003', found: '11220'
Test #7:
score: 0
Wrong Answer
time: 133ms
memory: 14388kb
input:
7958 7947
output:
224740 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 11...
result:
wrong answer 1st numbers differ - expected: '224482', found: '224740'
Test #8:
score: 0
Wrong Answer
time: 126ms
memory: 13984kb
input:
7623 7730
output:
215598 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 11...
result:
wrong answer 1st numbers differ - expected: '213444', found: '215598'
Test #9:
score: 0
Wrong Answer
time: 126ms
memory: 14072kb
input:
7845 7783
output:
220122 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 11...
result:
wrong answer 1st numbers differ - expected: '218916', found: '220122'
Test #10:
score: 0
Wrong Answer
time: 134ms
memory: 14120kb
input:
7881 7773
output:
221576 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 11...
result:
wrong answer 1st numbers differ - expected: '219451', found: '221576'
Test #11:
score: 0
Wrong Answer
time: 0ms
memory: 3552kb
input:
99414 98698
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Test #12:
score: 0
Wrong Answer
time: 0ms
memory: 3624kb
input:
98249 96148
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Test #13:
score: 0
Wrong Answer
time: 0ms
memory: 3552kb
input:
99003 96832
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Test #14:
score: 0
Wrong Answer
time: 0ms
memory: 3640kb
input:
98266 96030
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Test #15:
score: 0
Wrong Answer
time: 0ms
memory: 3612kb
input:
968207 958885
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Test #16:
score: 0
Wrong Answer
time: 0ms
memory: 3552kb
input:
959846 998397
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Test #17:
score: 0
Wrong Answer
time: 0ms
memory: 3640kb
input:
965821 972280
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Test #18:
score: 0
Wrong Answer
time: 0ms
memory: 3512kb
input:
7855098 7962479
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Test #19:
score: 0
Wrong Answer
time: 0ms
memory: 3636kb
input:
7841076 29648718
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Test #20:
score: 0
Wrong Answer
time: 0ms
memory: 3700kb
input:
29365129 29012208
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements