ログイン
新規登録
AtsuoCoder Waseda Tour Finals 2025
読込中…
Home
Tasks
Clar
Submissions
Standings
提出 2f5e7075-ff92-4204-ad01-76ed290a9d7e
コード
#include <bits/stdc++.h> using namespace std; int main(){ int N,M,H,ans = INT_MAX; cin >> N >> M >> H; //vector<vector<pair<long long,long long>>> dp(N,vector<long long>(M,INT_MAX)); //dp[0][0] = 0; vector<int> D(N),T(N); for(int i = 0;i < N;i++) cin >> D[i] >> T[i]; for(int i = 0;i < 2 << N;i++){ vector<bool> A(N,false); long long count = 0; for(int j = 0;j < N;i++){ A[j] = ((i % 2) == 1 ? true : false); count += ((i % 2 == 1 ? 1 : 0)); } if(count == M){ int t = 0,h = 0; for(int j = 0;j < M;j++){ if(A[j]){ t += T[j]; h += D[j]; } } if(H > h) ans = min(ans,t); } } }
結果
問題
点数
言語
結果
実行時間
メモリ
G - Contest
0
C++
TLE
2100 ms
4860 KiB