Submission #1948568
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define dbg(x) cout<<#x" = "<<(x)<<ln
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;
struct oreno_initializer {
oreno_initializer() {
cin.tie(0);
ios::sync_with_stdio(0);
}
} oreno_initializer;
// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .。.:( ^ω^)・゚+.。.:( ^ω^)・゚+.。.:( ^ω^)・゚+.。.:( ^ω^)・゚+.。.:( ^ω^)・゚+
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・
ll n, h, a[100000], b[100000], bs, bt, am, r;
signed main() {
cin >> n >> h;
rep(i,n) cin >> a[i] >> b[i];
am = *max_element(a, a+n);
rep(i,n) if (am<b[i]) bs += b[i], bt++;
r = (ll)ceil(1.*(h-bs)/am) + bt;
cout << r << ln;
}
Submission Info
Submission Time |
|
Task |
D - Katana Thrower |
User |
creep04 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1954 Byte |
Status |
WA |
Exec Time |
22 ms |
Memory |
1792 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 400 |
Status |
|
|
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 |
22 ms |
1792 KB |
b07 |
AC |
1 ms |
256 KB |
b08 |
AC |
22 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 |
12 ms |
1792 KB |
b14 |
WA |
13 ms |
1792 KB |
b15 |
AC |
12 ms |
1792 KB |
b16 |
AC |
12 ms |
1792 KB |
b17 |
AC |
16 ms |
1792 KB |
b18 |
AC |
15 ms |
1792 KB |
b19 |
AC |
13 ms |
1792 KB |
b20 |
WA |
15 ms |
1792 KB |
b21 |
WA |
15 ms |
1792 KB |
b22 |
AC |
16 ms |
1792 KB |
b23 |
AC |
1 ms |
256 KB |
b24 |
AC |
2 ms |
256 KB |