QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#510515#9158. 分数Insert_Username_Here0 0ms0kbC++20973b2024-08-09 07:59:062024-08-09 07:59:07

Judging History

你现在查看的是最新测评结果

  • [2024-08-09 07:59:07]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-08-09 07:59:06]
  • 提交

answer

#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
const ll mod = 998244353;
// cope counter = 2254
#pragma GCC optimize("Ofast,unroll-loops")

ll n, m, ans, cd, j;
inline void bk(ll a, ll b, ll c, ll d, ll i) {
	cd = c ? (m - d) / c : 1e9;
	ans += min(a ? (n - b) / a : (ll)1e9, cd) - i + 1 + max(min(a ? (m - b) / a : (ll)1e9, cd) - i + 1, 0ll);
	j = 1;
	while(1) {
		if(a * max(i, j) + b > m || (c + 2 * a * j) * max(i, j) + d + 2 * b * j > n) break;
		bk(c + 2 * a * j, d + 2 * b * j, a, b, max(i, j));
		j++;
	}
}
inline void kb(ll a, ll b, ll i) {
	j = 1;
	while(1) {
		if(b + 2 * j * a > m || a + 2 * max(i, j + 1) * (b + 2 * j * a) > n) break;
		kb(b + 2 * j * a, a, max(i, j + 1));
		j++;
	}
	bk(2 * a, b, 0, a, i);
}

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m;
	if(n < m) swap(n, m);
	kb(1, 0, 1);
	cout << ans << "\n";
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 0
Time Limit Exceeded

input:

99 99

output:


result:


Pretest #2:

score: 0
Time Limit Exceeded

input:

98 97

output:


result:


Pretest #3:

score: 0
Time Limit Exceeded

input:

99 96

output:


result:


Pretest #4:

score: 0
Time Limit Exceeded

input:

995 977

output:


result:


Pretest #5:

score: 0
Time Limit Exceeded

input:

991 990

output:


result:


Pretest #6:

score: 0
Time Limit Exceeded

input:

976 968

output:


result:


Pretest #7:

score: 0
Time Limit Exceeded

input:

7602 7864

output:


result:


Pretest #8:

score: 0
Time Limit Exceeded

input:

7959 7735

output:


result:


Pretest #9:

score: 0
Time Limit Exceeded

input:

7878 7863

output:


result:


Pretest #10:

score: 0
Time Limit Exceeded

input:

7788 7658

output:


result:


Pretest #11:

score: 0
Time Limit Exceeded

input:

95399 99767

output:


result:


Pretest #12:

score: 0
Time Limit Exceeded

input:

98051 99642

output:


result:


Pretest #13:

score: 0
Time Limit Exceeded

input:

95624 96007

output:


result:


Pretest #14:

score: 0
Time Limit Exceeded

input:

99208 98047

output:


result:


Pretest #15:

score: 0
Time Limit Exceeded

input:

997417 967722

output:


result:


Pretest #16:

score: 0
Time Limit Exceeded

input:

987807 956529

output:


result:


Pretest #17:

score: 0
Time Limit Exceeded

input:

971654 984345

output:


result:


Pretest #18:

score: 0
Time Limit Exceeded

input:

7892259 7983727

output:


result:


Pretest #19:

score: 0
Time Limit Exceeded

input:

7937869 29796968

output:


result:


Pretest #20:

score: 0
Time Limit Exceeded

input:

29717543 29510173

output:


result:



Final Tests

Test #1:

score: 0
Time Limit Exceeded

input:

96 98

output:


result:


Test #2:

score: 0
Time Limit Exceeded

input:

100 99

output:


result:


Test #3:

score: 0
Time Limit Exceeded

input:

99 99

output:


result:


Test #4:

score: 0
Time Limit Exceeded

input:

963 951

output:


result:


Test #5:

score: 0
Time Limit Exceeded

input:

958 974

output:


result:


Test #6:

score: 0
Time Limit Exceeded

input:

966 990

output:


result:


Test #7:

score: 0
Time Limit Exceeded

input:

7958 7947

output:


result:


Test #8:

score: 0
Time Limit Exceeded

input:

7623 7730

output:


result:


Test #9:

score: 0
Time Limit Exceeded

input:

7845 7783

output:


result:


Test #10:

score: 0
Time Limit Exceeded

input:

7881 7773

output:


result:


Test #11:

score: 0
Time Limit Exceeded

input:

99414 98698

output:


result:


Test #12:

score: 0
Time Limit Exceeded

input:

98249 96148

output:


result:


Test #13:

score: 0
Time Limit Exceeded

input:

99003 96832

output:


result:


Test #14:

score: 0
Time Limit Exceeded

input:

98266 96030

output:


result:


Test #15:

score: 0
Time Limit Exceeded

input:

968207 958885

output:


result:


Test #16:

score: 0
Time Limit Exceeded

input:

959846 998397

output:


result:


Test #17:

score: 0
Time Limit Exceeded

input:

965821 972280

output:


result:


Test #18:

score: 0
Time Limit Exceeded

input:

7855098 7962479

output:


result:


Test #19:

score: 0
Time Limit Exceeded

input:

7841076 29648718

output:


result:


Test #20:

score: 0
Time Limit Exceeded

input:

29365129 29012208

output:


result: