Submission #1947780


Source Code Expand

#include <bits/stdc++.h>
 
using namespace std;
 
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
ll n,h;
ll a[100005],b[100005];
 
int main() {

slld(n);slld(h);
for(int i=1;i<=n;i++)
slld(a[i]),slld(b[i]);

sort(a+1,a+n+1);
sort(b+1,b+n+1);
reverse(b+1,b+n+1);
ll x=a[n];
for(int i=1;i<=n;i++)
b[i]+=b[i-1];
ll ans=INF;
for(int i=0;i<=n;i++)
	ans=min(ans,(max(h-b[i],0ll)/x)+((max(h-b[i],0ll)%x)!=0)+i);
plld(ans);
	return 0;
           } 

Submission Info

Submission Time
Task D - Katana Thrower
User spj_29
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1012 Byte
Status AC
Exec Time 31 ms
Memory 1792 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:29:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 slld(n);slld(h);
        ^
./Main.cpp:29:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 slld(n);slld(h);
                ^
./Main.cpp:31:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 slld(a[i]),slld(b[i]);
                      ^
./Main.cpp:31:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 4
AC × 24
Set Name Test Cases
Sample a01, a02, a03, a04
All a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24
Case Name Status Exec Time Memory
a01 AC 1 ms 256 KB
a02 AC 1 ms 256 KB
a03 AC 1 ms 256 KB
a04 AC 1 ms 256 KB
b05 AC 1 ms 256 KB
b06 AC 28 ms 1792 KB
b07 AC 1 ms 256 KB
b08 AC 28 ms 1792 KB
b09 AC 1 ms 256 KB
b10 AC 1 ms 256 KB
b11 AC 1 ms 256 KB
b12 AC 1 ms 256 KB
b13 AC 20 ms 1792 KB
b14 AC 19 ms 1792 KB
b15 AC 19 ms 1792 KB
b16 AC 20 ms 1792 KB
b17 AC 31 ms 1792 KB
b18 AC 28 ms 1792 KB
b19 AC 24 ms 1792 KB
b20 AC 25 ms 1792 KB
b21 AC 29 ms 1792 KB
b22 AC 30 ms 1792 KB
b23 AC 1 ms 256 KB
b24 AC 2 ms 256 KB