Submission #1335627
Source Code Expand
#include<iostream> #include<stdio.h> #include<string.h> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) int main() { int n, a, b; cin >> n >> a >> b; a = a - b; int hp[100001] = { 0 }, h[100001] = { 0 }; REP(i, n) { cin >> h[i]; } long long count = 1, ookii = 0, ok = 1000000000, no = 0; while (1) { REP(i, 100001) { hp[i] = h[i]; } ookii = 0; int mae = count; count = (no + ok) / 2; //cout << count << endl; if (ok - no < 2) { cout << mae << endl; break; } for (int i = 0; i < n; i++) { hp[i] -= b*count; if (hp[i] > 0) { hp[i] -= a; i--; ookii++; if (ookii > count) { break; } } } if (ookii <= count) { ok = count; } else { no = count; } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Widespread |
User | keidaroo |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 816 Byte |
Status | WA |
Exec Time | 675 ms |
Memory | 1024 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 | 4 ms | 1024 KB |
a02 | WA | 4 ms | 1024 KB |
a03 | WA | 7 ms | 1024 KB |
b04 | AC | 4 ms | 1024 KB |
b05 | WA | 66 ms | 1024 KB |
b06 | WA | 675 ms | 1024 KB |
b07 | WA | 68 ms | 1024 KB |
b08 | AC | 65 ms | 1024 KB |
b09 | WA | 492 ms | 1024 KB |
b10 | WA | 125 ms | 1024 KB |
b11 | WA | 113 ms | 1024 KB |
b12 | WA | 80 ms | 1024 KB |
b13 | WA | 84 ms | 1024 KB |