QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#528924 | #8774. Manhattan Walk | The_Hallak# | WA | 0ms | 3552kb | C++17 | 690b | 2024-08-24 03:15:03 | 2024-08-24 03:15:04 |
Judging History
answer
#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long
#define YES "Yes"
#define NO "No"
#define endline '\n'
using namespace std;
const ll N = 5e5 + 10, MM = 998244353, MAX = 1e18;
int solve() {
ll n,p;cin>>n>>p;
vector<ll>v(n);
for(int i=0;i<n;i++){
cin>>v[i];
}
ll pre=0;
for(int i=0;i<n;i++){
ll sum=i*(v[i]-1)+pre;
if(p-sum<v[i])return cout<<i<<endline,0;
pre+=v[i];
}
cout<<n<<endline;
return 0;
}
int main() {
speed;
int t = 1;
//cin >> t;
int i = 1;
while (t--) {
//cout << "Case #" << i++ << ": ";
solve();
}
return 0;
}
/*
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3552kb
input:
2 3 8
output:
0
result:
wrong answer 1st numbers differ - expected: '2.8750000', found: '0.0000000', error = '1.0000000'