Submission #137557

# Submission time Handle Problem Language Result Execution time Memory
137557 2019-07-28T06:30:38 Z 이온조(#3279) Coins (BOI06_coins) C++14
0 / 100
1000 ms 363412 KB
#include <bits/stdc++.h>
using namespace std;

const int L = 500000000;
int N, K, C[500009], A[500009], mx = -1, mxi;
char D[L];

int main() {
	scanf("%d%d",&N,&K);
	for(int i=1; i<=N; i++) {
		scanf("%d%d",&C[i],&A[i]);
		A[i] = 1 - A[i];
	}
	for(int i=1, j=1; i<K && i - C[j] <= L; i++) {
		if(i == C[j+1]) ++j;
		D[i] = D[i - C[j]] + A[j];
		if(mx < D[i]) mx = D[i], mxi = K - i;
	}
	printf("%d\n%d\n", mx, mxi);
	return 0;
}

Compilation message

coins.cpp: In function 'int main()':
coins.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&N,&K);
  ~~~~~^~~~~~~~~~~~~~
coins.cpp:11:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&C[i],&A[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 359308 KB Time limit exceeded
2 Incorrect 2 ms 504 KB Output isn't correct
3 Execution timed out 1102 ms 363412 KB Time limit exceeded
4 Execution timed out 1081 ms 348592 KB Time limit exceeded
5 Execution timed out 1086 ms 347960 KB Time limit exceeded
6 Execution timed out 1095 ms 359800 KB Time limit exceeded
7 Execution timed out 1079 ms 311424 KB Time limit exceeded
8 Execution timed out 1101 ms 330540 KB Time limit exceeded
9 Execution timed out 1084 ms 320340 KB Time limit exceeded
10 Execution timed out 1042 ms 307240 KB Time limit exceeded