QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#21221 | #1253. Abstract Circular Cover | chestizcy | WA | 3252ms | 9444kb | C++17 | 1.4kb | 2022-03-03 19:47:59 | 2022-05-08 02:36:15 |
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],all[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]);
std::iota(all+1,all+n+1,1);std::shuffle(all+1,all+n+1,rnd);
for(int i=n,p=1;i>=3;--i){
int T=(1.0*n/i-(i==n?0:1.0*n/(i+1)))*20;
while(p<=n&&T--)solve(i,all[p++]);
}
for(int i=1;i<=n;++i)printf("%d%c",ans[i]," \n"[i==n]);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 3628kb
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: 2ms
memory: 3608kb
input:
1 15
output:
15
result:
ok "15"
Test #3:
score: 0
Accepted
time: 3217ms
memory: 9428kb
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: 0
Accepted
time: 3252ms
memory: 9384kb
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:
ok 850 tokens
Test #5:
score: 0
Accepted
time: 3243ms
memory: 9340kb
input:
850 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 100000...
output:
890977 890978 890979 890980 890981 890982 890983 890984 890985 890986 890987 890988 890989 890990 890991 890992 890993 890994 890995 890996 890997 890998 890999 891000 891001 891002 891003 891004 891005 891006 891007 891008 891009 891010 891011 891012 891013 891014 891015 891016 891017 891018 891019...
result:
ok 850 tokens
Test #6:
score: -100
Wrong Answer
time: 3191ms
memory: 9444kb
input:
850 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 100000...
output:
907746 907747 907748 907749 907750 907751 907752 907753 907754 907755 907756 907757 907758 907759 907760 907761 907762 907763 907764 907765 907766 907767 907768 907769 907770 907771 907772 907773 907774 907775 907776 907777 907778 907779 907780 907781 907782 907783 907784 907785 907786 907787 907788...
result:
wrong answer 120th words differ - expected: '907865', found: '1000119'