QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#514710 | #9158. 分数 | synonym# | 0 | 2805ms | 3756kb | C++23 | 1.1kb | 2024-08-11 07:16:14 | 2024-08-11 07:16:14 |
Judging History
answer
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define int long long
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int vf(int a, int b) {
if (gcd(a,b) != 1) return 0;
int iter = 5;
while (1) {
iter--;
if (iter==0) return 0;
if (a < b) swap(a,b);
if (2*b > a) return 0;
a %= 2*b;
if (a == 0) return 1;
}
}
signed main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int n, m; cin >> n >> m;
assert(n<1e4);
assert(m<1e4);
int cnt = 0;
for (int i=1; i<=n; i++) {
for (int j=1; j<=m; j++) {
cnt += vf(i,j);
}
}
cout<<cnt;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 1ms
memory: 3644kb
input:
99 99
output:
404
result:
wrong answer 1st numbers differ - expected: '406', found: '404'
Pretest #2:
score: 0
Wrong Answer
time: 1ms
memory: 3624kb
input:
98 97
output:
403
result:
wrong answer 1st numbers differ - expected: '405', found: '403'
Pretest #3:
score: 0
Wrong Answer
time: 0ms
memory: 3584kb
input:
99 96
output:
394
result:
wrong answer 1st numbers differ - expected: '396', found: '394'
Pretest #4:
score: 0
Wrong Answer
time: 36ms
memory: 3556kb
input:
995 977
output:
9867
result:
wrong answer 1st numbers differ - expected: '11153', found: '9867'
Pretest #5:
score: 0
Wrong Answer
time: 32ms
memory: 3756kb
input:
991 990
output:
9924
result:
wrong answer 1st numbers differ - expected: '11220', found: '9924'
Pretest #6:
score: 0
Wrong Answer
time: 34ms
memory: 3712kb
input:
976 968
output:
9651
result:
wrong answer 1st numbers differ - expected: '10900', found: '9651'
Pretest #7:
score: 0
Wrong Answer
time: 2647ms
memory: 3644kb
input:
7602 7864
output:
149902
result:
wrong answer 1st numbers differ - expected: '215706', found: '149902'
Pretest #8:
score: 0
Wrong Answer
time: 2737ms
memory: 3676kb
input:
7959 7735
output:
152806
result:
wrong answer 1st numbers differ - expected: '220256', found: '152806'
Pretest #9:
score: 0
Wrong Answer
time: 2752ms
memory: 3640kb
input:
7878 7863
output:
153279
result:
wrong answer 1st numbers differ - expected: '221162', found: '153279'
Pretest #10:
score: 0
Wrong Answer
time: 2638ms
memory: 3704kb
input:
7788 7658
output:
149712
result:
wrong answer 1st numbers differ - expected: '215323', found: '149712'
Pretest #11:
score: 0
Runtime Error
input:
95399 99767
output:
result:
Pretest #12:
score: 0
Runtime Error
input:
98051 99642
output:
result:
Pretest #13:
score: 0
Runtime Error
input:
95624 96007
output:
result:
Pretest #14:
score: 0
Runtime Error
input:
99208 98047
output:
result:
Pretest #15:
score: 0
Runtime Error
input:
997417 967722
output:
result:
Pretest #16:
score: 0
Runtime Error
input:
987807 956529
output:
result:
Pretest #17:
score: 0
Runtime Error
input:
971654 984345
output:
result:
Pretest #18:
score: 0
Runtime Error
input:
7892259 7983727
output:
result:
Pretest #19:
score: 0
Runtime Error
input:
7937869 29796968
output:
result:
Pretest #20:
score: 0
Runtime Error
input:
29717543 29510173
output:
result:
Final Tests
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3580kb
input:
96 98
output:
394
result:
wrong answer 1st numbers differ - expected: '396', found: '394'
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3696kb
input:
100 99
output:
406
result:
wrong answer 1st numbers differ - expected: '408', found: '406'
Test #3:
score: 0
Wrong Answer
time: 1ms
memory: 3648kb
input:
99 99
output:
404
result:
wrong answer 1st numbers differ - expected: '406', found: '404'
Test #4:
score: 0
Wrong Answer
time: 33ms
memory: 3580kb
input:
963 951
output:
9435
result:
wrong answer 1st numbers differ - expected: '10634', found: '9435'
Test #5:
score: 0
Wrong Answer
time: 34ms
memory: 3648kb
input:
958 974
output:
9567
result:
wrong answer 1st numbers differ - expected: '10795', found: '9567'
Test #6:
score: 0
Wrong Answer
time: 35ms
memory: 3568kb
input:
966 990
output:
9744
result:
wrong answer 1st numbers differ - expected: '11003', found: '9744'
Test #7:
score: 0
Wrong Answer
time: 2805ms
memory: 3696kb
input:
7958 7947
output:
155435
result:
wrong answer 1st numbers differ - expected: '224482', found: '155435'
Test #8:
score: 0
Wrong Answer
time: 2612ms
memory: 3704kb
input:
7623 7730
output:
148563
result:
wrong answer 1st numbers differ - expected: '213444', found: '148563'
Test #9:
score: 0
Wrong Answer
time: 2719ms
memory: 3620kb
input:
7845 7783
output:
151905
result:
wrong answer 1st numbers differ - expected: '218916', found: '151905'
Test #10:
score: 0
Wrong Answer
time: 2721ms
memory: 3644kb
input:
7881 7773
output:
152250
result:
wrong answer 1st numbers differ - expected: '219451', found: '152250'
Test #11:
score: 0
Runtime Error
input:
99414 98698
output:
result:
Test #12:
score: 0
Runtime Error
input:
98249 96148
output:
result:
Test #13:
score: 0
Runtime Error
input:
99003 96832
output:
result:
Test #14:
score: 0
Runtime Error
input:
98266 96030
output:
result:
Test #15:
score: 0
Runtime Error
input:
968207 958885
output:
result:
Test #16:
score: 0
Runtime Error
input:
959846 998397
output:
result:
Test #17:
score: 0
Runtime Error
input:
965821 972280
output:
result:
Test #18:
score: 0
Runtime Error
input:
7855098 7962479
output:
result:
Test #19:
score: 0
Runtime Error
input:
7841076 29648718
output:
result:
Test #20:
score: 0
Runtime Error
input:
29365129 29012208