/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 23ms 568.0 KiB
#3 Wrong Answer 37ms 532.0 KiB

Code

#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
  int t;
  cin >> t;
  while (t--){
    ll n, k, d, ans = -1, mx = -1;
    cin >> n >> k >> d;
    vector<ll> a(n + 1);
    for (int i = 1; i <= n; i++){
      cin >> a[i];
      a[i] += a[i - 1];
    }
    for (int i = 1; i + k - 1 <= n; i++){
      if ((a[i + k - 1] - a[i - 1]) % d == 0 && (a[i + k - 1] - a[i - 1]) > mx){
        mx = (a[i + k - 1] - a[i - 1]);
        ans = i;
      }
    }
    cout << ans << endl;
  }
}

Information

Submit By
Type
Submission
Problem
P1190 Segment Strength
Contest
Brain Booster #9
Language
C++17 (G++ 13.2.0)
Submit At
2025-04-06 16:21:29
Judged At
2025-04-06 16:21:29
Judged By
Score
0
Total Time
37ms
Peak Memory
568.0 KiB