Submission #3595996
Source Code Expand
#include <bits/stdc++.h> #define N 100005 #define LL long long #define mp make_pair #define pb push_back #define ppb pop_back using namespace std; LL int top,sum,n,a,b,ar[N]; LL int check(LL int x) { sum=x*b; LL int q=0; for(int i=1;i<=n;i++) if(ar[i]-sum>0) { q+=(ar[i]-sum+a-b-1)/(a-b); //~ q=q/(a-b); } //~ cout<<x*b; if(q<=x) return 1; else return 0; } int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); cin>>n>>a>>b; for(int i=1;i<=n;i++) cin>>ar[i]; int l=0,r=(10e9)+5; while(r>=l) { int tutmac=check((r+l)/2); if(tutmac) r=(r+l)/2-1; else l=(r+l)/2+1; } cout<<l; }
Submission Info
Submission Time | |
---|---|
Task | C - Bugged |
User | Fasho |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 689 Byte |
Status | RE |
Exec Time | 99 ms |
Memory | 256 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:33:19: warning: overflow in implicit constant conversion [-Woverflow] int l=0,r=(10e9)+5; ^
Judge Result
Set Name | Sample | All | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | a01, a02, a03 |
All | a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
a01 | WA | 1 ms | 256 KB |
a02 | RE | 98 ms | 256 KB |
a03 | AC | 1 ms | 256 KB |
b04 | WA | 1 ms | 256 KB |
b05 | RE | 99 ms | 256 KB |
b06 | WA | 1 ms | 256 KB |
b07 | WA | 1 ms | 256 KB |
b08 | WA | 1 ms | 256 KB |
b09 | WA | 1 ms | 256 KB |
b10 | AC | 1 ms | 256 KB |
b11 | RE | 99 ms | 256 KB |
b12 | AC | 1 ms | 256 KB |