Submission #72558718
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vi;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
ll n,k,x;
cin >> n >> k >> x;
vi a(n);
rep(i,0,n){
cin >> a[i];
}
sort(a.begin(),a.end());
ll b = n-k;
ll count = 0 ;
rep(i,0,n){
count+=a[i];
if(count>=x){
b+=i+1;
break;
}
}
if(b>n){
cout << -1 << endl;
}
else{
cout << b << endl;
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Sake or Water |
| User | unknown_2406 |
| Language | C++23 (GCC 15.2.0) |
| Score | 0 |
| Code Size | 804 Byte |
| Status | WA |
| Exec Time | 36 ms |
| Memory | 5792 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 300 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example_00.txt, example_01.txt, example_02.txt |
| All | example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example_00.txt | AC | 1 ms | 3660 KiB |
| example_01.txt | AC | 1 ms | 3452 KiB |
| example_02.txt | AC | 1 ms | 3452 KiB |
| hand_00.txt | AC | 17 ms | 5720 KiB |
| hand_01.txt | AC | 17 ms | 5688 KiB |
| hand_02.txt | AC | 34 ms | 5684 KiB |
| hand_03.txt | WA | 34 ms | 5732 KiB |
| hand_04.txt | WA | 34 ms | 5792 KiB |
| hand_05.txt | WA | 34 ms | 5664 KiB |
| hand_06.txt | WA | 34 ms | 5620 KiB |
| hand_07.txt | WA | 1 ms | 3504 KiB |
| hand_08.txt | WA | 1 ms | 3596 KiB |
| hand_09.txt | AC | 1 ms | 3480 KiB |
| hand_10.txt | WA | 1 ms | 3516 KiB |
| hand_11.txt | WA | 17 ms | 5708 KiB |
| random_00.txt | WA | 35 ms | 5660 KiB |
| random_01.txt | WA | 35 ms | 5792 KiB |
| random_02.txt | WA | 35 ms | 5660 KiB |
| random_03.txt | WA | 35 ms | 5620 KiB |
| random_04.txt | WA | 35 ms | 5640 KiB |
| random_05.txt | WA | 35 ms | 5664 KiB |
| random_06.txt | WA | 35 ms | 5660 KiB |
| random_07.txt | WA | 36 ms | 5696 KiB |
| random_08.txt | WA | 35 ms | 5696 KiB |
| random_09.txt | AC | 36 ms | 5664 KiB |
| random_10.txt | WA | 35 ms | 5652 KiB |
| random_11.txt | WA | 35 ms | 5696 KiB |
| random_12.txt | WA | 35 ms | 5696 KiB |
| random_13.txt | WA | 35 ms | 5732 KiB |
| random_14.txt | WA | 36 ms | 5732 KiB |
| random_15.txt | WA | 35 ms | 5696 KiB |
| random_16.txt | WA | 34 ms | 5792 KiB |
| random_17.txt | WA | 36 ms | 5720 KiB |