QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#211820 | #5359. 面国建设 | yfq3 | 100 ✓ | 680ms | 6888kb | C++14 | 1.4kb | 2023-10-12 21:32:11 | 2023-10-12 21:32:11 |
Judging History
answer
#include<bits/stdc++.h>
#define rep(i,l,r) for(auto i(l),i##_end(r);i<=i##_end;++i)
#define per(i,r,l) for(auto i(r),i##_end(l);i>=i##_end;--i)
#define fi first
#define se second
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define SZ(a) ((int)(a).size())
using namespace std;
using cint=const int;
using ll=long long;
using cll=const long long;
using ull=unsigned long long;
#if __SIZEOF_POINTER__==8
using lll=__int128;
#endif
using db=double;
using ld=long double;
using pii=pair<int,int>;
using vi=vector<int>;
using vii=vector<pii>;
mt19937 rnd(random_device{}());
mt19937_64 rnd64(random_device{}());
void debug()
{
cerr<<"\n";
}
template<typename T,typename ...Args>
void debug(T t,Args ...args)
{
cerr<<t;
if(sizeof...(args)) cerr<<", ";
debug(args...);
}
#define deb(x...) do{ cerr<<#x<<": "; debug(x); }while(0)
template<typename T>
bool cmax(T &a,const T &b){ return b>a?a=b,1:0; }
template<typename T>
bool cmin(T &a,const T &b){ return b<a?a=b,1:0; }
const int N=2e5+5,INF=1e9;
int S,C;
int f[N*2],t[N*2];
int main()
{
scanf("%d%d",&S,&C); C/=2;
rep(i,1,2*S) f[i]=INF;
f[0]=0;
rep(i,1,(int)sqrt(S))
{
int ra=2*i-1;
rep(j,0,ra-1) t[j]=INF;
int rj=0,rji=0,cj=0,cji=0;
rep(j,0,2*S)
{
cmin(t[j%ra],f[j]-j/ra);
cmin(f[j],t[(j+i)%ra]+(j+i)/ra+i);
}
}
f[0]=2;
ll ans=0;
rep(i,0,2*S)
{
ans+=(max(min(C,2*S-i)+1-f[i],0)+1)/2;
}
printf("%lld\n",ans);
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 6
Accepted
Test #1:
score: 6
Accepted
time: 1ms
memory: 5844kb
input:
4 10
output:
7
result:
ok single line: '7'
Test #2:
score: 0
Accepted
time: 1ms
memory: 5884kb
input:
7 2
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
6 6
output:
2
result:
ok single line: '2'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
10 7
output:
2
result:
ok single line: '2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 4096kb
input:
8 10
output:
8
result:
ok single line: '8'
Test #6:
score: 0
Accepted
time: 1ms
memory: 6172kb
input:
10 8
output:
5
result:
ok single line: '5'
Subtask #2:
score: 12
Accepted
Dependency #1:
100%
Accepted
Test #7:
score: 12
Accepted
time: 1ms
memory: 6172kb
input:
399 994
output:
125266
result:
ok single line: '125266'
Test #8:
score: 0
Accepted
time: 1ms
memory: 5852kb
input:
742 645
output:
184225
result:
ok single line: '184225'
Test #9:
score: 0
Accepted
time: 0ms
memory: 5884kb
input:
932 900
output:
328424
result:
ok single line: '328424'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
943 971
output:
357500
result:
ok single line: '357500'
Test #11:
score: 0
Accepted
time: 1ms
memory: 5892kb
input:
955 897
output:
335817
result:
ok single line: '335817'
Test #12:
score: 0
Accepted
time: 1ms
memory: 5884kb
input:
903 971
output:
340678
result:
ok single line: '340678'
Test #13:
score: 0
Accepted
time: 1ms
memory: 6172kb
input:
954 978
output:
364964
result:
ok single line: '364964'
Test #14:
score: 0
Accepted
time: 1ms
memory: 5956kb
input:
908 902
output:
319849
result:
ok single line: '319849'
Test #15:
score: 0
Accepted
time: 1ms
memory: 5872kb
input:
934 908
output:
332030
result:
ok single line: '332030'
Test #16:
score: 0
Accepted
time: 1ms
memory: 6140kb
input:
961 924
output:
348391
result:
ok single line: '348391'
Subtask #3:
score: 31
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #17:
score: 31
Accepted
time: 0ms
memory: 5908kb
input:
1951 2977
output:
2228950
result:
ok single line: '2228950'
Test #18:
score: 0
Accepted
time: 0ms
memory: 6176kb
input:
4626 5415
output:
10254469
result:
ok single line: '10254469'
Test #19:
score: 0
Accepted
time: 4ms
memory: 3884kb
input:
5983 4766
output:
12197679
result:
ok single line: '12197679'
Test #20:
score: 0
Accepted
time: 4ms
memory: 5936kb
input:
5094 5425
output:
11472637
result:
ok single line: '11472637'
Test #21:
score: 0
Accepted
time: 4ms
memory: 4172kb
input:
5598 4989
output:
11826716
result:
ok single line: '11826716'
Test #22:
score: 0
Accepted
time: 4ms
memory: 6120kb
input:
5577 5188
output:
12208146
result:
ok single line: '12208146'
Test #23:
score: 0
Accepted
time: 4ms
memory: 5884kb
input:
5688 5804
output:
13807758
result:
ok single line: '13807758'
Test #24:
score: 0
Accepted
time: 4ms
memory: 3884kb
input:
5856 5309
output:
13161066
result:
ok single line: '13161066'
Test #25:
score: 0
Accepted
time: 2ms
memory: 5876kb
input:
5378 5859
output:
13061554
result:
ok single line: '13061554'
Test #26:
score: 0
Accepted
time: 4ms
memory: 5940kb
input:
5729 5635
output:
13554877
result:
ok single line: '13554877'
Subtask #4:
score: 51
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #27:
score: 51
Accepted
time: 573ms
memory: 5516kb
input:
177004 361104
output:
23708315017
result:
ok single line: '23708315017'
Test #28:
score: 0
Accepted
time: 521ms
memory: 6304kb
input:
165955 330686
output:
20513788444
result:
ok single line: '20513788444'
Test #29:
score: 0
Accepted
time: 673ms
memory: 5672kb
input:
196341 379690
output:
28146877343
result:
ok single line: '28146877343'
Test #30:
score: 0
Accepted
time: 477ms
memory: 5072kb
input:
157573 352489
output:
19921485073
result:
ok single line: '19921485073'
Test #31:
score: 0
Accepted
time: 568ms
memory: 5236kb
input:
174981 388787
output:
24469285862
result:
ok single line: '24469285862'
Test #32:
score: 0
Accepted
time: 583ms
memory: 6252kb
input:
179053 386583
output:
25166888234
result:
ok single line: '25166888234'
Test #33:
score: 0
Accepted
time: 598ms
memory: 5140kb
input:
181239 344051
output:
23675514126
result:
ok single line: '23675514126'
Test #34:
score: 0
Accepted
time: 662ms
memory: 6536kb
input:
194920 395575
output:
28656790378
result:
ok single line: '28656790378'
Test #35:
score: 0
Accepted
time: 588ms
memory: 6852kb
input:
179011 399658
output:
25686628463
result:
ok single line: '25686628463'
Test #36:
score: 0
Accepted
time: 609ms
memory: 5556kb
input:
183359 394921
output:
26352667541
result:
ok single line: '26352667541'
Test #37:
score: 0
Accepted
time: 668ms
memory: 5660kb
input:
195360 389377
output:
28442072522
result:
ok single line: '28442072522'
Test #38:
score: 0
Accepted
time: 650ms
memory: 5628kb
input:
191706 397710
output:
28122791775
result:
ok single line: '28122791775'
Test #39:
score: 0
Accepted
time: 650ms
memory: 6452kb
input:
191762 396427
output:
28074496102
result:
ok single line: '28074496102'
Test #40:
score: 0
Accepted
time: 675ms
memory: 5412kb
input:
197603 386515
output:
28732769430
result:
ok single line: '28732769430'
Test #41:
score: 0
Accepted
time: 642ms
memory: 5312kb
input:
190189 377777
output:
26893005583
result:
ok single line: '26893005583'
Test #42:
score: 0
Accepted
time: 640ms
memory: 5320kb
input:
189770 391031
output:
27434979251
result:
ok single line: '27434979251'
Test #43:
score: 0
Accepted
time: 662ms
memory: 6888kb
input:
194039 389514
output:
28192735947
result:
ok single line: '28192735947'
Test #44:
score: 0
Accepted
time: 680ms
memory: 6168kb
input:
197815 388430
output:
28870257334
result:
ok single line: '28870257334'
Test #45:
score: 0
Accepted
time: 640ms
memory: 5328kb
input:
189687 383322
output:
27060812973
result:
ok single line: '27060812973'
Test #46:
score: 0
Accepted
time: 671ms
memory: 5668kb
input:
196059 391296
output:
28672072117
result:
ok single line: '28672072117'