QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#392988 | #2432. Go with the Flow | nocriz | TL | 1188ms | 4204kb | C++14 | 699b | 2024-04-18 01:40:27 | 2024-04-18 01:40:27 |
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(0, (int)s.size());
ln.push_back(s.size());
}
int ans = 0, ccl;
for(int ml = cm; ml<= n * 85; ml++) {
vector<int> cx(ml, 0), nx(ml, 0);
int cv = -1;
for(auto ct: ln) {
if(cv + 1 + ct > ml) {
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;
}
}
cout<<ccl<<' '<<ans<<endl;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3640kb
Test #2:
score: 0
Accepted
time: 1ms
memory: 3944kb
Test #3:
score: 0
Accepted
time: 0ms
memory: 3656kb
Test #4:
score: 0
Accepted
time: 0ms
memory: 3608kb
Test #5:
score: 0
Accepted
time: 31ms
memory: 3844kb
Test #6:
score: 0
Accepted
time: 2ms
memory: 3984kb
Test #7:
score: 0
Accepted
time: 1ms
memory: 3752kb
Test #8:
score: 0
Accepted
time: 1ms
memory: 3920kb
Test #9:
score: 0
Accepted
time: 1ms
memory: 3728kb
Test #10:
score: 0
Accepted
time: 1ms
memory: 3756kb
Test #11:
score: 0
Accepted
time: 1ms
memory: 3660kb
Test #12:
score: 0
Accepted
time: 2ms
memory: 3780kb
Test #13:
score: 0
Accepted
time: 1095ms
memory: 4120kb
Test #14:
score: 0
Accepted
time: 1188ms
memory: 4144kb
Test #15:
score: 0
Accepted
time: 1164ms
memory: 4204kb
Test #16:
score: -100
Time Limit Exceeded