QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#505839 | #2432. Go with the Flow | Yanagi_Origami | AC ✓ | 751ms | 4396kb | C++14 | 977b | 2024-08-05 12:20:03 | 2024-08-05 12:20:03 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
int n,maxlen, ans;
int main() {
cin>>n;
vector<string> S(n);
rep(i,0,n-1) cin>>S[i], maxlen=max(maxlen, (int)S[i].size());
int id = -1, steps = 1e9+7;
for (;steps>ans; ++maxlen) {
steps = 0;
vector<int> f(maxlen);
for (int i = 0, j = 0; i < n; i = j + 1) {
steps++;
int width=S[i].size();
vector<int> nf(maxlen);
j=i;
for(;j+1<n&&width+1+S[j+1].size()<= maxlen;j++) {
nf[width]=f[width] + 1;
if (width<maxlen-1) nf[width]=max(nf[width], f[width + 1] + 1);
if (width>=1) nf[width]=max(nf[width], f[width - 1] + 1);
if (nf[width]>ans) ans=nf[width], id = maxlen;
width+=1+S[j+1].size();
}
f.swap(nf);
}
}
cout<<id<<' '<<ans<<'\n';
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3756kb
Test #2:
score: 0
Accepted
time: 0ms
memory: 3588kb
Test #3:
score: 0
Accepted
time: 0ms
memory: 3584kb
Test #4:
score: 0
Accepted
time: 0ms
memory: 3596kb
Test #5:
score: 0
Accepted
time: 0ms
memory: 3588kb
Test #6:
score: 0
Accepted
time: 0ms
memory: 3732kb
Test #7:
score: 0
Accepted
time: 0ms
memory: 3788kb
Test #8:
score: 0
Accepted
time: 0ms
memory: 3576kb
Test #9:
score: 0
Accepted
time: 0ms
memory: 3588kb
Test #10:
score: 0
Accepted
time: 0ms
memory: 3572kb
Test #11:
score: 0
Accepted
time: 0ms
memory: 3576kb
Test #12:
score: 0
Accepted
time: 0ms
memory: 3796kb
Test #13:
score: 0
Accepted
time: 3ms
memory: 3904kb
Test #14:
score: 0
Accepted
time: 3ms
memory: 3828kb
Test #15:
score: 0
Accepted
time: 3ms
memory: 3856kb
Test #16:
score: 0
Accepted
time: 36ms
memory: 3800kb
Test #17:
score: 0
Accepted
time: 33ms
memory: 3824kb
Test #18:
score: 0
Accepted
time: 32ms
memory: 3760kb
Test #19:
score: 0
Accepted
time: 3ms
memory: 3944kb
Test #20:
score: 0
Accepted
time: 1ms
memory: 3660kb
Test #21:
score: 0
Accepted
time: 134ms
memory: 4160kb
Test #22:
score: 0
Accepted
time: 7ms
memory: 4040kb
Test #23:
score: 0
Accepted
time: 1ms
memory: 3580kb
Test #24:
score: 0
Accepted
time: 1ms
memory: 3808kb
Test #25:
score: 0
Accepted
time: 89ms
memory: 4148kb
Test #26:
score: 0
Accepted
time: 115ms
memory: 3972kb
Test #27:
score: 0
Accepted
time: 117ms
memory: 3952kb
Test #28:
score: 0
Accepted
time: 24ms
memory: 3776kb
Test #29:
score: 0
Accepted
time: 27ms
memory: 3980kb
Test #30:
score: 0
Accepted
time: 28ms
memory: 4024kb
Test #31:
score: 0
Accepted
time: 265ms
memory: 4396kb
Test #32:
score: 0
Accepted
time: 17ms
memory: 4092kb
Test #33:
score: 0
Accepted
time: 6ms
memory: 3884kb
Test #34:
score: 0
Accepted
time: 1ms
memory: 3864kb
Test #35:
score: 0
Accepted
time: 0ms
memory: 3580kb
Test #36:
score: 0
Accepted
time: 153ms
memory: 3932kb
Test #37:
score: 0
Accepted
time: 271ms
memory: 4372kb
Test #38:
score: 0
Accepted
time: 314ms
memory: 4188kb
Test #39:
score: 0
Accepted
time: 465ms
memory: 4328kb
Test #40:
score: 0
Accepted
time: 511ms
memory: 4356kb
Test #41:
score: 0
Accepted
time: 557ms
memory: 4288kb
Test #42:
score: 0
Accepted
time: 210ms
memory: 4176kb
Test #43:
score: 0
Accepted
time: 291ms
memory: 4368kb
Test #44:
score: 0
Accepted
time: 310ms
memory: 4368kb
Test #45:
score: 0
Accepted
time: 671ms
memory: 4100kb
Test #46:
score: 0
Accepted
time: 611ms
memory: 4116kb
Test #47:
score: 0
Accepted
time: 630ms
memory: 4256kb
Test #48:
score: 0
Accepted
time: 524ms
memory: 4116kb
Test #49:
score: 0
Accepted
time: 641ms
memory: 4176kb
Test #50:
score: 0
Accepted
time: 563ms
memory: 4068kb
Test #51:
score: 0
Accepted
time: 667ms
memory: 4064kb
Test #52:
score: 0
Accepted
time: 618ms
memory: 4088kb
Test #53:
score: 0
Accepted
time: 283ms
memory: 4072kb
Test #54:
score: 0
Accepted
time: 1ms
memory: 3868kb
Test #55:
score: 0
Accepted
time: 26ms
memory: 3776kb
Test #56:
score: 0
Accepted
time: 2ms
memory: 3912kb
Test #57:
score: 0
Accepted
time: 9ms
memory: 4048kb
Test #58:
score: 0
Accepted
time: 5ms
memory: 4056kb
Test #59:
score: 0
Accepted
time: 30ms
memory: 3712kb
Test #60:
score: 0
Accepted
time: 12ms
memory: 3736kb
Test #61:
score: 0
Accepted
time: 1ms
memory: 3840kb
Test #62:
score: 0
Accepted
time: 19ms
memory: 3688kb
Test #63:
score: 0
Accepted
time: 96ms
memory: 4108kb
Test #64:
score: 0
Accepted
time: 79ms
memory: 3768kb
Test #65:
score: 0
Accepted
time: 751ms
memory: 4276kb
Test #66:
score: 0
Accepted
time: 0ms
memory: 3764kb