QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#528924#8774. Manhattan WalkThe_Hallak#WA 0ms3552kbC++17690b2024-08-24 03:15:032024-08-24 03:15:04

Judging History

你现在查看的是最新测评结果

  • [2024-08-24 03:15:04]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3552kb
  • [2024-08-24 03:15:03]
  • 提交

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'