QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#502690 | #9158. 分数 | Flamire | 0 | 3159ms | 3952kb | C++20 | 682b | 2024-08-03 11:47:31 | 2024-08-03 11:47:33 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n,m;ll ans,CNT;
inline int fdiv(int p,int q){return (p+(p<0))/q-(p<0);}
void dfs(int a,int b)
{//printf("dfs(%d,%d)\n",a,b);
// if(b>m||a>n)return;
++CNT;
if(b<=n)ans+=(n-b)/a/2+1;
ans+=(m-b)/a/2+1;
int lim=fdiv(n-b,2*a);
int mxk=min(lim,fdiv(m-2*b-a,4*a));
int hfk=min(lim,fdiv(m-4*b-a,8*a));
int mxn=min(mxk,fdiv(n-2*b-a,4*a));
ans+=max(0,mxn-hfk)+max(0,mxk-hfk);
for(int k=0;k<=hfk;++k)dfs(b+2*k*a,2*b+(4*k+1)*a);
}
int main()
{
scanf("%d%d",&n,&m);
if(n>m)swap(n,m);
dfs(1,2);
printf("%lld\n",ans);
printf("CNT:%lld\n",CNT);
fclose(stdin);fclose(stdout);return 0;
}
详细
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 1ms
memory: 3944kb
input:
99 99
output:
406 CNT:27
result:
wrong output format Expected integer, but "CNT:27" found
Pretest #2:
score: 0
Wrong Answer
time: 0ms
memory: 3792kb
input:
98 97
output:
405 CNT:27
result:
wrong output format Expected integer, but "CNT:27" found
Pretest #3:
score: 0
Wrong Answer
time: 0ms
memory: 3860kb
input:
99 96
output:
396 CNT:27
result:
wrong output format Expected integer, but "CNT:27" found
Pretest #4:
score: 0
Wrong Answer
time: 0ms
memory: 3872kb
input:
995 977
output:
11153 CNT:719
result:
wrong output format Expected integer, but "CNT:719" found
Pretest #5:
score: 0
Wrong Answer
time: 0ms
memory: 3868kb
input:
991 990
output:
11220 CNT:714
result:
wrong output format Expected integer, but "CNT:714" found
Pretest #6:
score: 0
Wrong Answer
time: 0ms
memory: 3880kb
input:
976 968
output:
10900 CNT:697
result:
wrong output format Expected integer, but "CNT:697" found
Pretest #7:
score: 0
Wrong Answer
time: 1ms
memory: 3736kb
input:
7602 7864
output:
215706 CNT:13985
result:
wrong output format Expected integer, but "CNT:13985" found
Pretest #8:
score: 0
Wrong Answer
time: 1ms
memory: 3864kb
input:
7959 7735
output:
220256 CNT:14243
result:
wrong output format Expected integer, but "CNT:14243" found
Pretest #9:
score: 0
Wrong Answer
time: 1ms
memory: 3948kb
input:
7878 7863
output:
221162 CNT:14024
result:
wrong output format Expected integer, but "CNT:14024" found
Pretest #10:
score: 0
Wrong Answer
time: 1ms
memory: 3864kb
input:
7788 7658
output:
215323 CNT:13804
result:
wrong output format Expected integer, but "CNT:13804" found
Pretest #11:
score: 0
Wrong Answer
time: 3ms
memory: 3800kb
input:
95399 99767
output:
8285295 CNT:542050
result:
wrong output format Expected integer, but "CNT:542050" found
Pretest #12:
score: 0
Wrong Answer
time: 6ms
memory: 3944kb
input:
98051 99642
output:
8439713 CNT:541127
result:
wrong output format Expected integer, but "CNT:541127" found
Pretest #13:
score: 0
Wrong Answer
time: 6ms
memory: 3876kb
input:
95624 96007
output:
8068127 CNT:512736
result:
wrong output format Expected integer, but "CNT:512736" found
Pretest #14:
score: 0
Wrong Answer
time: 6ms
memory: 3876kb
input:
99208 98047
output:
8412610 CNT:537678
result:
wrong output format Expected integer, but "CNT:537678" found
Pretest #15:
score: 0
Wrong Answer
time: 166ms
memory: 3868kb
input:
997417 967722
output:
229917323 CNT:14890887
result:
wrong output format Expected integer, but "CNT:14890887" found
Pretest #16:
score: 0
Wrong Answer
time: 157ms
memory: 3780kb
input:
987807 956529
output:
226426912 CNT:14684925
result:
wrong output format Expected integer, but "CNT:14684925" found
Pretest #17:
score: 0
Wrong Answer
time: 155ms
memory: 3864kb
input:
971654 984345
output:
228363805 CNT:14611036
result:
wrong output format Expected integer, but "CNT:14611036" found
Pretest #18:
score: 0
Wrong Answer
time: 3159ms
memory: 3788kb
input:
7892259 7983727
output:
4647501224 CNT:297043290
result:
wrong output format Expected integer, but "CNT:297043290" found
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
Wrong Answer
time: 0ms
memory: 3788kb
input:
96 98
output:
396 CNT:27
result:
wrong output format Expected integer, but "CNT:27" found
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3856kb
input:
100 99
output:
408 CNT:27
result:
wrong output format Expected integer, but "CNT:27" found
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3944kb
input:
99 99
output:
406 CNT:27
result:
wrong output format Expected integer, but "CNT:27" found
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 3944kb
input:
963 951
output:
10634 CNT:679
result:
wrong output format Expected integer, but "CNT:679" found
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 3880kb
input:
958 974
output:
10795 CNT:693
result:
wrong output format Expected integer, but "CNT:693" found
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 3864kb
input:
966 990
output:
11003 CNT:714
result:
wrong output format Expected integer, but "CNT:714" found
Test #7:
score: 0
Wrong Answer
time: 1ms
memory: 3792kb
input:
7958 7947
output:
224482 CNT:14243
result:
wrong output format Expected integer, but "CNT:14243" found
Test #8:
score: 0
Wrong Answer
time: 1ms
memory: 3864kb
input:
7623 7730
output:
213444 CNT:13646
result:
wrong output format Expected integer, but "CNT:13646" found
Test #9:
score: 0
Wrong Answer
time: 1ms
memory: 3940kb
input:
7845 7783
output:
218916 CNT:13948
result:
wrong output format Expected integer, but "CNT:13948" found
Test #10:
score: 0
Wrong Answer
time: 1ms
memory: 3792kb
input:
7881 7773
output:
219451 CNT:14034
result:
wrong output format Expected integer, but "CNT:14034" found
Test #11:
score: 0
Wrong Answer
time: 6ms
memory: 3880kb
input:
99414 98698
output:
8465217 CNT:539326
result:
wrong output format Expected integer, but "CNT:539326" found
Test #12:
score: 0
Wrong Answer
time: 6ms
memory: 3792kb
input:
98249 96148
output:
8237486 CNT:530337
result:
wrong output format Expected integer, but "CNT:530337" found
Test #13:
score: 0
Wrong Answer
time: 6ms
memory: 3872kb
input:
99003 96832
output:
8324931 CNT:536133
result:
wrong output format Expected integer, but "CNT:536133" found
Test #14:
score: 0
Wrong Answer
time: 6ms
memory: 3796kb
input:
98266 96030
output:
8231065 CNT:530464
result:
wrong output format Expected integer, but "CNT:530464" found
Test #15:
score: 0
Wrong Answer
time: 152ms
memory: 3788kb
input:
968207 958885
output:
223522215 CNT:14266426
result:
wrong output format Expected integer, but "CNT:14266426" found
Test #16:
score: 0
Wrong Answer
time: 155ms
memory: 3756kb
input:
959846 998397
output:
228770873 CNT:14912024
result:
wrong output format Expected integer, but "CNT:14912024" found
Test #17:
score: 0
Wrong Answer
time: 153ms
memory: 3860kb
input:
965821 972280
output:
225359210 CNT:14353004
result:
wrong output format Expected integer, but "CNT:14353004" found
Test #18:
score: 0
Wrong Answer
time: 3150ms
memory: 3952kb
input:
7855098 7962479
output:
4622947400 CNT:295905652
result:
wrong output format Expected integer, but "CNT:295905652" found
Test #19:
score: 0
Time Limit Exceeded
input:
7841076 29648718
output:
result:
Test #20:
score: 0
Time Limit Exceeded
input:
29365129 29012208