QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#392988#2432. Go with the FlownocrizTL 1188ms4204kbC++14699b2024-04-18 01:40:272024-04-18 01:40:27

Judging History

你现在查看的是最新测评结果

  • [2024-04-18 01:40:27]
  • 评测
  • 测评结果:TL
  • 用时:1188ms
  • 内存:4204kb
  • [2024-04-18 01:40:27]
  • 提交

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