QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#392993 | #2432. Go with the Flow | nocriz | AC ✓ | 1379ms | 4180kb | C++14 | 754b | 2024-04-18 01:51:06 | 2024-04-18 01:51:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
vector<int> ln;
int cm = 0;
for(int i=0;i<n;i++) {
string s;
cin>>s;
cm = max(cm, (int)s.size());
ln.push_back(s.size());
}
int ans = 0, ccl = cm;
for(int ml = cm; ml<= n * 85; ml++) {
vector<int> cx(ml, 0), nx(ml, 0);
int cv = -1, cln = 0;
for(auto ct: ln) {
if(cv + 1 + ct > ml) {
cln += 1;
cv = -1;
cx = nx;
nx = vector<int>(ml, 0);
}
if(cv > 0) {
nx[cv] = max(max(cx[cv-1], cx[cv]), cx[cv+1]) + 1;
//cout<<cv<<' '<<nx[cv]<<endl;
if(nx[cv] > ans) {
ans = nx[cv];
ccl = ml;
}
}
cv = cv + 1 + ct;
}
if( cln < ans) break;
}
cout<<ccl<<' '<<ans<<endl;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3568kb
Test #2:
score: 0
Accepted
time: 0ms
memory: 3804kb
Test #3:
score: 0
Accepted
time: 0ms
memory: 3532kb
Test #4:
score: 0
Accepted
time: 1ms
memory: 3484kb
Test #5:
score: 0
Accepted
time: 0ms
memory: 3576kb
Test #6:
score: 0
Accepted
time: 0ms
memory: 3572kb
Test #7:
score: 0
Accepted
time: 0ms
memory: 3536kb
Test #8:
score: 0
Accepted
time: 0ms
memory: 3572kb
Test #9:
score: 0
Accepted
time: 0ms
memory: 3600kb
Test #10:
score: 0
Accepted
time: 1ms
memory: 3536kb
Test #11:
score: 0
Accepted
time: 0ms
memory: 3840kb
Test #12:
score: 0
Accepted
time: 0ms
memory: 3596kb
Test #13:
score: 0
Accepted
time: 3ms
memory: 3956kb
Test #14:
score: 0
Accepted
time: 3ms
memory: 3708kb
Test #15:
score: 0
Accepted
time: 3ms
memory: 3716kb
Test #16:
score: 0
Accepted
time: 35ms
memory: 3644kb
Test #17:
score: 0
Accepted
time: 27ms
memory: 3696kb
Test #18:
score: 0
Accepted
time: 31ms
memory: 3760kb
Test #19:
score: 0
Accepted
time: 3ms
memory: 3664kb
Test #20:
score: 0
Accepted
time: 1ms
memory: 3628kb
Test #21:
score: 0
Accepted
time: 200ms
memory: 3832kb
Test #22:
score: 0
Accepted
time: 8ms
memory: 3644kb
Test #23:
score: 0
Accepted
time: 1ms
memory: 3628kb
Test #24:
score: 0
Accepted
time: 1ms
memory: 3620kb
Test #25:
score: 0
Accepted
time: 140ms
memory: 3764kb
Test #26:
score: 0
Accepted
time: 179ms
memory: 4060kb
Test #27:
score: 0
Accepted
time: 184ms
memory: 3764kb
Test #28:
score: 0
Accepted
time: 29ms
memory: 3992kb
Test #29:
score: 0
Accepted
time: 40ms
memory: 3776kb
Test #30:
score: 0
Accepted
time: 37ms
memory: 3704kb
Test #31:
score: 0
Accepted
time: 531ms
memory: 3820kb
Test #32:
score: 0
Accepted
time: 20ms
memory: 3880kb
Test #33:
score: 0
Accepted
time: 4ms
memory: 3668kb
Test #34:
score: 0
Accepted
time: 1ms
memory: 3856kb
Test #35:
score: 0
Accepted
time: 1ms
memory: 3680kb
Test #36:
score: 0
Accepted
time: 238ms
memory: 3836kb
Test #37:
score: 0
Accepted
time: 551ms
memory: 3768kb
Test #38:
score: 0
Accepted
time: 566ms
memory: 3832kb
Test #39:
score: 0
Accepted
time: 822ms
memory: 3824kb
Test #40:
score: 0
Accepted
time: 904ms
memory: 4072kb
Test #41:
score: 0
Accepted
time: 984ms
memory: 4056kb
Test #42:
score: 0
Accepted
time: 414ms
memory: 3656kb
Test #43:
score: 0
Accepted
time: 509ms
memory: 3712kb
Test #44:
score: 0
Accepted
time: 549ms
memory: 4032kb
Test #45:
score: 0
Accepted
time: 1130ms
memory: 4180kb
Test #46:
score: 0
Accepted
time: 1052ms
memory: 3980kb
Test #47:
score: 0
Accepted
time: 1078ms
memory: 3968kb
Test #48:
score: 0
Accepted
time: 1021ms
memory: 3972kb
Test #49:
score: 0
Accepted
time: 1150ms
memory: 4164kb
Test #50:
score: 0
Accepted
time: 931ms
memory: 3796kb
Test #51:
score: 0
Accepted
time: 1131ms
memory: 3976kb
Test #52:
score: 0
Accepted
time: 1147ms
memory: 3908kb
Test #53:
score: 0
Accepted
time: 473ms
memory: 3836kb
Test #54:
score: 0
Accepted
time: 1ms
memory: 3716kb
Test #55:
score: 0
Accepted
time: 40ms
memory: 3980kb
Test #56:
score: 0
Accepted
time: 2ms
memory: 3940kb
Test #57:
score: 0
Accepted
time: 10ms
memory: 3692kb
Test #58:
score: 0
Accepted
time: 10ms
memory: 3704kb
Test #59:
score: 0
Accepted
time: 48ms
memory: 3824kb
Test #60:
score: 0
Accepted
time: 22ms
memory: 3816kb
Test #61:
score: 0
Accepted
time: 0ms
memory: 3716kb
Test #62:
score: 0
Accepted
time: 28ms
memory: 3736kb
Test #63:
score: 0
Accepted
time: 163ms
memory: 3816kb
Test #64:
score: 0
Accepted
time: 133ms
memory: 3828kb
Test #65:
score: 0
Accepted
time: 1379ms
memory: 3984kb
Test #66:
score: 0
Accepted
time: 0ms
memory: 3536kb