Submission #56228

# Submission time Handle Problem Language Result Execution time Memory
56228 2018-07-10T11:04:19 Z dennisstar None (KOI17_cook) C++11
0 / 100
5 ms 2680 KB
#include <bits/stdc++.h>
using namespace std;
int Dp[3010][3010];
int N,M,S,E,T;
int ar[3010][3010], ban[3010];
deque<pair<int,int> > Dq[3010];
set<pair<int,int> > Set;
int main()
{
//	freopen("input.txt","r", stdin);
	scanf("%d %d %d %d %d", &N, &M, &S, &E, &T);
	int i, j; set<pair<int,int> >::iterator it;
	for(i=1; i<=N; i++) for (j=1; j<=M; j++) scanf("%d", &ar[i][j]), ar[i][j]+=ar[i][j-1];
	for(i=1; i<=N; i++) scanf("%d", &ban[i]);
	for(i=S; i<=M; i++) {
		Set.clear();
		if(i==S||i>=2*S) for(j=1; j<=N; j++) {
			while(!Dq[j].empty()&&Dq[j].front().second<i-E) Dq[j].pop_front();
			while(!Dq[j].empty()&&Dq[j].back().first>=Dp[j][i-S]-ar[j][i-S]) Dq[j].pop_back();
			Dq[j].push_back(make_pair(Dp[j][i-S]-ar[j][i-S],i-S));
		}
		for(j=1; j<=N; j++) Set.insert(make_pair(Dq[j].front().first+ar[j][i]+T, j));
		for(j=1; j<=N; j++) {
			it=Set.begin();
			while((*it).second==j||(*it).second==ban[j]) ++it;
			Dp[j][i]=(*it).first;
		}
	}
	int mn=Dp[1][M];
	for(i=2; i<=N; i++) mn=min(mn,Dp[i][M]);
	printf("%d", mn);
	return 0;
}

Compilation message

cook.cpp: In function 'int main()':
cook.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d %d %d", &N, &M, &S, &E, &T);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cook.cpp:13:65: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=1; i<=N; i++) for (j=1; j<=M; j++) scanf("%d", &ar[i][j]), ar[i][j]+=ar[i][j-1];
                                           ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
cook.cpp:14:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=1; i<=N; i++) scanf("%d", &ban[i]);
                      ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -