제출 #1304707

#제출 시각아이디문제언어결과실행 시간메모리
1304707quollcucumber`Pinball (JOI14_pinball)C++20
0 / 100
25 ms572 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int parents[1005]; signed main(){ int m, n; cin>> m >> n; pair<pair<int, int>, pair<int, int>> arr[m]; for(int i = 0; i < m;i ++) { cin >> arr[i].first.first >> arr[i].first.second >> arr[i].second.first >> arr[i].second.second; } queue<vector<bool>> q; q.push({}); for(int i = 0; i< m; i++) { int sz = q.size(); for(int j = 0; j < sz; j++) { vector<bool> a = q.front(); a.push_back(true); q.push(a); a.pop_back(); a.push_back(false); q.push(a); q.pop(); } } int minval = INT_MAX; while(!q.empty()) { for(int i = 0; i < 1005; i++) parents[i] = i; vector<bool> vec = q.front(); q.pop(); int total = 0; for(int i = 0; i < m; i++) { if(vec[i]) { total += arr[i].second.second; // for(int j = arr[i].first.first; j <= arr[i].first.second; j++) { // parents[j] = arr[i].second.first; // } for(int j = 1; j <= n; j++) { if((parents[j]) >= arr[i].first.first && parents[j] <= arr[i].first.second) { parents[j] = arr[i].second.first; } } } } set<int> s; for(int i = 1; i <= n; i++) { s.insert(parents[i]); } if(s.size() == 1) { minval = min(minval, total); } } cout<<minval<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...