제출 #1352498

#제출 시각아이디문제언어결과실행 시간메모리
1352498mxhrvsCandy (EGOI23_candy)C++20
0 / 100
0 ms344 KiB
#include<bits/stdc++.h>
using namespace std;
signed main(){
    long long  n,f,t;
    cin >> n >> f >> t;
    long long  a[n+1];
    long long  sum = 0;
    for(long long  i = 1; i <= n; i ++){
        cin >> a[i];
        sum += a[i];
    }
    if(sum < t or f < t) {
        cout << "NO\n";
        return 0;
    }
    if(a[1] > 1){
        if(f == 1){
            if(a[1] >= t) cout << 0 << "\n";
            else cout << 1 << "\n";
        }
        else if(f == 2){
            if(a[1] + a[2] >= t) cout << 0 << "\n";
            else cout << 1 << "\n";
        }
        else if(f == 3){
            if(sum >= t) cout << 0 << "\n";
        }
    }
    else{
        
            long long  cnt = 0;
            for(long long  i = 1; i <= f; i ++){
                if(a[i] == 0) cnt += f - i + 1;
            }
            cout << cnt << "\n";
    }

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...