QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#21219 | #1253. Abstract Circular Cover | chestizcy | WA | 7257ms | 9336kb | C++17 | 1.3kb | 2022-03-03 19:45:16 | 2022-05-08 02:35:37 |
Judging History
answer
#include<bits/stdc++.h>
template <typename _Tp>void read(_Tp &x){
char ch(getchar());bool f(false);while(!isdigit(ch))f|=ch==45,ch=getchar();
x=ch&15,ch=getchar();while(isdigit(ch))x=x*10+(ch&15),ch=getchar();
if(f)x=-x;
}
template <typename _Tp,typename... Args>void read(_Tp &t,Args &...args){read(t);read(args...);}
std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());
template <typename _Tp>inline void chmin(_Tp &a,const _Tp &b){a=a<b?a:b;}
const int N=855,inf=0x3f3f3f3f;
int c[N][N],ans[N],n,f[N][N],p[N];
void solve(int k,int x){
int m=0;for(int i=x;i<=n;++i)p[++m]=i;
for(int i=1;i<x;++i)p[++m]=i;
for(int i=1;i<=n+1;++i)memset(f[i],63,(k+1)<<2);
f[1][0]=0;
for(int i=1;i<=n;++i){
int o=p[i];
for(int j=1;i+j<=n+1;++j){
int v=c[o][j];
for(int t=0;t<k;++t)chmin(f[i+j][t+1],f[i][t]+v);
}
}
for(int i=1;i<=k;++i)chmin(ans[i],f[n+1][i]);
}
int main(){
read(n);for(int i=1;i<=n;++i)for(int j=1;j<=n;++j)read(c[i][j]);
memset(ans,63,sizeof(ans));
for(int i=1;i<=n;++i)chmin(ans[1],c[i][n]);
for(int i=1;i<=n;++i)for(int j=1;j<n;++j)chmin(ans[2],c[i][j]+c[i+j>n?i+j-n:i+j][n-j]);
for(int i=n;i>=3;--i){
int T=(1.0*n/i-(i==n?0:1.0*n/(i+1)))*15;
while(T--)solve(i,rnd()%n+1);
}
for(int i=1;i<=n;++i)printf("%d%c",ans[i]," \n"[i==n]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 3780kb
input:
3 10 12 23 7 4 11 8 5 3
output:
3 12 25
result:
ok 3 tokens
Test #2:
score: 0
Accepted
time: 3ms
memory: 3644kb
input:
1 15
output:
15
result:
ok "15"
Test #3:
score: 0
Accepted
time: 7257ms
memory: 9336kb
input:
850 467844 492130 605609 643857 26979 997775 457911 823516 154840 985025 993710 334965 480280 45505 851380 765414 512285 661374 745909 563360 878563 887945 542943 288759 124012 159576 828454 705380 24125 806150 695873 109057 933855 632721 259819 784272 398751 935451 393059 788917 560334 786155 54986...
output:
260 583 4456 6370 5867 10516 8445 11322 22257 25758 29686 36603 43777 37503 42305 54915 55969 74889 75170 96572 108980 118941 131680 143190 159544 172374 192023 199700 216054 236664 249640 263857 282365 298719 319329 332305 346522 367087 401391 418048 432265 452830 486603 507925 541698 567714 601189...
result:
ok 850 tokens
Test #4:
score: -100
Wrong Answer
time: 7166ms
memory: 9336kb
input:
850 1 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 999999 ...
output:
151599 151600 151601 151602 151603 151604 151605 151606 151607 151608 151609 151610 151611 151612 151613 151614 151615 151616 151617 151618 151619 151620 151621 151622 151623 151624 151625 151626 151627 151628 151629 151630 151631 151632 151633 151634 151635 151636 151637 151638 151639 151640 151641...
result:
wrong answer 84th words differ - expected: '151682', found: '303280'