General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
158665031 Practice:
hydra_cody
508C - 28 C++17 (GCC 7-32) Wrong answer on test 7 15 ms 12 KB 2022-05-28 08:11:45 2022-05-28 08:11:45
→ Source
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long int
#define lld long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define precise(ans)  cout<<fixed<<setprecision(15)<<ans
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pl;
typedef vector<int>     vi;
typedef vector<vi>      vvi;
typedef vector<vvi>    vvvi;
typedef vector<ll>      vl;
typedef vector<vl>      vvl;
typedef vector<pii>     vpii;
typedef vector<pl>      vpl;
const int mod = 1000000007;
#define PI 3.1415926535897932384626
const int M = 1e9 + 7;
// const int N = 1e7 + 10;
const int INF = (int) 1e9;
const long long INF64 = (long long) 1e18;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

void solve() {
  ll a,b,c;
  cin>>a>>b>>c;
  vector<ll> aa(a);
  for(ll i=0;i<a;i++){
    cin>>aa[i];
  }
  ll ans=0;
  vector<ll> bb(c);
  for(ll i=0;i<a;i++){
    ll x=aa[i]-c;
    if(aa[i]>x+b){
      // cout<<i;
      cout<<"-1"<<endl;
      return;
    }else{
      ll bur=0;
      for(ll j=c-1;j>=0;j--){
        if(i==0){
          bb[j]=aa[i]-bur+b;
          ans++;
          bur++;
        }else{
          ll x=aa[i]-bur+b;
          if(bb[j]>=aa[i]){
            continue;
          }else{
            bb[j]=x;
            ans++;
            bur++;
          }
        }
      }
    }
   /* for(ll j=0;j<c;j++){
      cout<<bb[j]<<" ";
    }
    cout<<ans<<" "<<endl;*/

  }
  cout<<ans<<endl;

}

int32_t main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  srand(chrono::high_resolution_clock::now().time_since_epoch().count());
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ll  t;
  t = 1;

//   cin >> t;
  while (t--) {
    solve();

  }

  return 0;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details