답안 #137556

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
137556 2019-07-28T06:28:50 Z 이온조(#3279) Coins (BOI06_coins) C++14
0 / 100
1000 ms 389240 KB
#include <bits/stdc++.h>
using namespace std;

const int L = 500000000;
int N, K, C[500009], A[500009], mx, 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++) {
		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\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]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1112 ms 389240 KB Time limit exceeded
2 Incorrect 2 ms 376 KB Output isn't correct
3 Execution timed out 1120 ms 385868 KB Time limit exceeded
4 Execution timed out 1105 ms 349304 KB Time limit exceeded
5 Execution timed out 1107 ms 385148 KB Time limit exceeded
6 Execution timed out 1110 ms 385740 KB Time limit exceeded
7 Execution timed out 1099 ms 351864 KB Time limit exceeded
8 Execution timed out 1063 ms 336248 KB Time limit exceeded
9 Execution timed out 1086 ms 344892 KB Time limit exceeded
10 Execution timed out 1108 ms 350732 KB Time limit exceeded