Submission #3246680
Source Code Expand
#include <iostream> #include <vector> #include <queue> #include <cmath> #include <bitset> #include <algorithm> #include <set> #include <string> #include <queue> using namespace std; #define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++) typedef long long ll; int main(){ int N, A, B; cin >> N >> A >> B; vector<int> hs(N, 0); rep(i, N){ cin >> hs[i]; } int l = 0; int r = 1e9; int ans = 1; while(l <= r){ ll t = 0; int mid = (l + r) / 2; double de = A - B; rep(i, N){ // midの必要性を検証. int tmp = hs[i] - B * mid; if(tmp > 0){ t += ceil((double)(tmp) / (de)); } } if(t > mid){ // mdではng l = mid + 1; }else{ // mdでもok. r = mid - 1; ans = mid; } } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Widespread |
User | zakou |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 998 Byte |
Status | WA |
Exec Time | 55 ms |
Memory | 640 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | a01, a02, a03 |
All | a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
a01 | AC | 1 ms | 256 KB |
a02 | AC | 1 ms | 256 KB |
a03 | AC | 1 ms | 256 KB |
b04 | AC | 1 ms | 256 KB |
b05 | WA | 50 ms | 640 KB |
b06 | AC | 55 ms | 640 KB |
b07 | AC | 52 ms | 640 KB |
b08 | AC | 52 ms | 640 KB |
b09 | AC | 43 ms | 640 KB |
b10 | WA | 44 ms | 640 KB |
b11 | WA | 53 ms | 640 KB |
b12 | WA | 53 ms | 640 KB |
b13 | AC | 52 ms | 640 KB |