QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#780200#2432. Go with the FlowLJY_ljyAC ✓2790ms4656kbC++111.4kb2024-11-25 08:14:252024-11-25 08:14:25

Judging History

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

  • [2024-11-25 08:14:25]
  • 评测
  • 测评结果:AC
  • 用时:2790ms
  • 内存:4656kb
  • [2024-11-25 08:14:25]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const int MAXN = 100;
const int MAXM = 3000;
char str[MAXN];
int n, len[MAXM], sum, maxx, cnt[MAXN * MAXM], ans, ansx, aa[MAXM], bb[MAXM];
int G[MAXM]; 
bool used[MAXN * MAXM];

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> str + 1;
		len[i] = strlen(str + 1);
		maxx = max(maxx, len[i]); 
		sum += len[i];
	}	
	for (int gap = maxx; gap < sum + n; gap++) {
		int maxx = 0;
		int j = 1, Len = 0, eid1 = 0, eid = 0;
		int len1 = 0, len2 = 0;
		while (j <= n) {
			++eid1;
			while (Len + len[j] <= gap && j <= n) {
				Len = Len + len[j] + 1;
				if (Len + len[j + 1] <= gap && j < n) {
					G[++eid] = Len;
					bb[++len2] = Len;
					int A = 0;
					if (used[Len - 1]) A = max(A, cnt[Len - 1]);
					if (used[Len]) A = max(A, cnt[Len]); 
					if (used[Len + 1]) A = max(A, cnt[Len + 1]);
					cnt[Len] = A + 1;
					maxx = max(maxx, cnt[Len]);
				}
				j++;
			}
			Len = 0;
			for (int i = 1; i <= len1; i++) used[aa[i]] = false;
			for (int i = 1; i <= len2; i++) used[bb[i]] = true;
			len1 = len2;
			for (int i = 1; i <= len2; i++) aa[i] = bb[i];
			len2 = 0;
		}
		for (int i = 1; i <= len2; i++) used[i] = false;
		for (int i = 1; i <= eid; i++) cnt[G[i]] = 0;
		if (maxx > ans) {
			ans = maxx;
			ansx = gap;
		}
	}
	cout << ansx << " " << ans << endl;
	return 0;
} 

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3724kb

Test #2:

score: 0
Accepted
time: 0ms
memory: 3584kb

Test #3:

score: 0
Accepted
time: 0ms
memory: 3652kb

Test #4:

score: 0
Accepted
time: 1ms
memory: 3652kb

Test #5:

score: 0
Accepted
time: 1ms
memory: 3580kb

Test #6:

score: 0
Accepted
time: 1ms
memory: 3720kb

Test #7:

score: 0
Accepted
time: 0ms
memory: 3580kb

Test #8:

score: 0
Accepted
time: 0ms
memory: 3644kb

Test #9:

score: 0
Accepted
time: 0ms
memory: 3648kb

Test #10:

score: 0
Accepted
time: 0ms
memory: 3644kb

Test #11:

score: 0
Accepted
time: 0ms
memory: 3588kb

Test #12:

score: 0
Accepted
time: 1ms
memory: 3708kb

Test #13:

score: 0
Accepted
time: 49ms
memory: 3688kb

Test #14:

score: 0
Accepted
time: 48ms
memory: 3648kb

Test #15:

score: 0
Accepted
time: 48ms
memory: 3712kb

Test #16:

score: 0
Accepted
time: 534ms
memory: 3820kb

Test #17:

score: 0
Accepted
time: 503ms
memory: 3956kb

Test #18:

score: 0
Accepted
time: 507ms
memory: 3816kb

Test #19:

score: 0
Accepted
time: 168ms
memory: 3748kb

Test #20:

score: 0
Accepted
time: 106ms
memory: 3692kb

Test #21:

score: 0
Accepted
time: 1336ms
memory: 4192kb

Test #22:

score: 0
Accepted
time: 2790ms
memory: 4656kb

Test #23:

score: 0
Accepted
time: 47ms
memory: 3640kb

Test #24:

score: 0
Accepted
time: 106ms
memory: 3720kb

Test #25:

score: 0
Accepted
time: 816ms
memory: 4132kb

Test #26:

score: 0
Accepted
time: 823ms
memory: 4024kb

Test #27:

score: 0
Accepted
time: 844ms
memory: 4028kb

Test #28:

score: 0
Accepted
time: 190ms
memory: 3872kb

Test #29:

score: 0
Accepted
time: 206ms
memory: 3800kb

Test #30:

score: 0
Accepted
time: 205ms
memory: 3924kb

Test #31:

score: 0
Accepted
time: 2590ms
memory: 4584kb

Test #32:

score: 0
Accepted
time: 1239ms
memory: 4196kb

Test #33:

score: 0
Accepted
time: 1072ms
memory: 4116kb

Test #34:

score: 0
Accepted
time: 46ms
memory: 3712kb

Test #35:

score: 0
Accepted
time: 0ms
memory: 3724kb

Test #36:

score: 0
Accepted
time: 1275ms
memory: 4176kb

Test #37:

score: 0
Accepted
time: 2678ms
memory: 4532kb

Test #38:

score: 0
Accepted
time: 2643ms
memory: 4564kb

Test #39:

score: 0
Accepted
time: 2107ms
memory: 4492kb

Test #40:

score: 0
Accepted
time: 2247ms
memory: 4404kb

Test #41:

score: 0
Accepted
time: 2282ms
memory: 4536kb

Test #42:

score: 0
Accepted
time: 2701ms
memory: 4588kb

Test #43:

score: 0
Accepted
time: 2736ms
memory: 4564kb

Test #44:

score: 0
Accepted
time: 2707ms
memory: 4588kb

Test #45:

score: 0
Accepted
time: 2107ms
memory: 4364kb

Test #46:

score: 0
Accepted
time: 2112ms
memory: 4348kb

Test #47:

score: 0
Accepted
time: 2119ms
memory: 4368kb

Test #48:

score: 0
Accepted
time: 2029ms
memory: 4476kb

Test #49:

score: 0
Accepted
time: 2552ms
memory: 4600kb

Test #50:

score: 0
Accepted
time: 2317ms
memory: 4540kb

Test #51:

score: 0
Accepted
time: 2123ms
memory: 4492kb

Test #52:

score: 0
Accepted
time: 2124ms
memory: 4496kb

Test #53:

score: 0
Accepted
time: 1750ms
memory: 4312kb

Test #54:

score: 0
Accepted
time: 1ms
memory: 3660kb

Test #55:

score: 0
Accepted
time: 69ms
memory: 3792kb

Test #56:

score: 0
Accepted
time: 3ms
memory: 3744kb

Test #57:

score: 0
Accepted
time: 2667ms
memory: 4588kb

Test #58:

score: 0
Accepted
time: 2678ms
memory: 4592kb

Test #59:

score: 0
Accepted
time: 83ms
memory: 3748kb

Test #60:

score: 0
Accepted
time: 39ms
memory: 3832kb

Test #61:

score: 0
Accepted
time: 1ms
memory: 3652kb

Test #62:

score: 0
Accepted
time: 32ms
memory: 3732kb

Test #63:

score: 0
Accepted
time: 260ms
memory: 3988kb

Test #64:

score: 0
Accepted
time: 104ms
memory: 3836kb

Test #65:

score: 0
Accepted
time: 1887ms
memory: 4348kb

Test #66:

score: 0
Accepted
time: 0ms
memory: 3728kb