/ Randle /

记录详情

Time Exceeded


  
# 状态 耗时 内存占用
#1 Accepted 4ms 2.344 MiB
#2 Accepted 3ms 2.348 MiB
#3 Accepted 3ms 2.371 MiB
#4 Accepted 123ms 4.465 MiB
#5 Time Exceeded ≥1003ms ≥7.125 MiB
#6 Time Exceeded ≥1003ms ≥7.715 MiB
#7 Time Exceeded ≥1007ms ≥26.605 MiB
#8 Time Exceeded ≥1000ms ≥33.492 MiB
#9 Time Exceeded ≥1003ms ≥32.844 MiB
#10 Time Exceeded ≥1008ms ≥38.605 MiB

代码

#include <stdio.h>
#include <iostream>
#define inf 1e9
using namespace std;
struct pair {
	int index;
	int val;
};
inline int read() {
	int k=0;
	char f=1;
	char c=getchar();
	for(; !isdigit(c); c=getchar() )
		if(c=='-')
			f=-1;
	for(; isdigit(c); c=getchar() )
		k=k*10+c-'0';
	return k*f;
}
int n,m,t;
int s[5002][1002],a[5002][1002],ans[1002];
void solve(int line) {
	int minid = 1,maxid = 0;
	for(int k = 1; k<=t; k++) {
		for(int i = k; i<=n; i++) {
			for(int j = i-k+1; j<=i; j++) {
				if(s[line][i]-s[line][j-1]>s[line][maxid]-s[line][minid-1]) {
					maxid = i,minid = j;
				} else if(s[line][i]-s[line][j-1]==s[line][maxid]-s[line][minid-1]) {
					if(i-j>maxid-minid) {
						maxid = i,minid = j;
					}
				}
			}
		}
	}
	if(minid==1&&maxid==0)return;
	for(int i = minid; i<=maxid; i++) ans[i]++;
}
int main() {
	n =read();
	m = read();
	t=  read();
	for(int i = 1; i<=m; i++) {
		for(int j = 1; j<=n; j++) {
			a[i][j] = read();
			s[i][j] = s[i][j-1]+a[i][j];
		}
	}
	for(int i = 1; i<=m; i++) solve(i);
	for(int i = 1; i<=n; i++) cout<<ans[i]<<" ";
	return 0;
}

信息

递交者
类型
递交
题目
骂战(原创)
题目数据
下载
语言
C++
递交时间
2017-10-12 19:45:08
评测时间
2017-10-12 19:45:08
评测机
分数
40
总耗时
≥6163ms
峰值内存
≥38.605 MiB