답안 #137565

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
137565 2019-07-28T06:36:11 Z 이온조(#3279) Coins (BOI06_coins) C++14
0 / 100
1000 ms 367480 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 + 1];

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++) {
		if(i == C[j+1]) ++j;
		if(i - C[j] <= L) D[i] = D[i - C[j]] + A[j];
		if(mx < D[i]) mx = D[i], mxi = K - i;
	}
	printf("%d\n%d", 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]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1111 ms 367480 KB Time limit exceeded
2 Incorrect 2 ms 476 KB Output isn't correct
3 Execution timed out 1087 ms 354792 KB Time limit exceeded
4 Execution timed out 1102 ms 363720 KB Time limit exceeded
5 Execution timed out 1076 ms 332780 KB Time limit exceeded
6 Execution timed out 1092 ms 356976 KB Time limit exceeded
7 Execution timed out 1085 ms 321044 KB Time limit exceeded
8 Execution timed out 1097 ms 332072 KB Time limit exceeded
9 Execution timed out 1092 ms 327692 KB Time limit exceeded
10 Execution timed out 1083 ms 316540 KB Time limit exceeded