Submission #137596

# Submission time Handle Problem Language Result Execution time Memory
137596 2019-07-28T07:13:50 Z 김현수(#3360) Coins (BOI06_coins) C++14
90 / 100
120 ms 6540 KB
#include<bits/stdc++.h>
using namespace std;

const int N = 500005;

int n, m, a[N], b[N], ans1, ans2;

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) {
		scanf("%d%d",&a[i],&b[i]);
	}
	a[n+1] = m;
	for(int i=1;i<=n;i++) {
		if(b[i]) continue;
		if(ans2 + a[i] < a[i+1]) {
			ans1++;
			ans2 += a[i];
		}
	}
	printf("%d\n%d\n", ans1, m-ans2);
}

Compilation message

coins.cpp: In function 'int main()':
coins.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~
coins.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&a[i],&b[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 108 ms 6368 KB Output is correct
8 Incorrect 106 ms 6364 KB Output isn't correct
9 Correct 120 ms 6540 KB Output is correct
10 Correct 118 ms 6244 KB Output is correct