Submission #137573

# Submission time Handle Problem Language Result Execution time Memory
137573 2019-07-28T06:44:06 Z 이온조(#3279) Coins (BOI06_coins) C++14
10 / 100
1000 ms 162256 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]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 158928 KB Time limit exceeded
2 Correct 3 ms 376 KB Output is correct
3 Execution timed out 1078 ms 159900 KB Time limit exceeded
4 Execution timed out 1086 ms 149020 KB Time limit exceeded
5 Execution timed out 1079 ms 158448 KB Time limit exceeded
6 Execution timed out 1089 ms 162256 KB Time limit exceeded
7 Execution timed out 1063 ms 144588 KB Time limit exceeded
8 Execution timed out 1074 ms 149020 KB Time limit exceeded
9 Execution timed out 1067 ms 145264 KB Time limit exceeded
10 Execution timed out 1087 ms 149600 KB Time limit exceeded