| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1354442 | hsuan._.0528 | Candy (EGOI23_candy) | C++20 | 3095 ms | 344 KiB |
//pB
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pii pair<int, int>
#define S second
#define F first
const int maxn = 1000 + 10;
const int inf=1e18;
int n, f;
LL t;
pii a[maxn];
LL pre[maxn];
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin>>n>>f>>t;
LL cntf=0, ans=inf;
for(int i=1; i<=n; i++){
cin>>a[i].F;
a[i].S=i;
// pre[i]=pre[i-1]+a[i];
if(i<=f) cntf+=i;
}
sort(a+1, a+1+n);
do{
LL cnt=0, sum=0;
for(int i=1; i<=f; i++){
// cout<<a[i].F<<" ";
cnt+=a[i].S;
sum+=a[i].F;
}
//cout<<" / "<<sum<<" "<<cnt<<"\n";
if(sum>=t) ans=min(ans, cnt-cntf);
}while(next_permutation(a+1, a+1+n));
if(ans==inf) cout<<"NO";
else cout<<ans;
}컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
