Submission #908882

# Submission time Handle Problem Language Result Execution time Memory
908882 2024-01-17T01:06:28 Z vjudge1 Pinball (JOI14_pinball) C++17
0 / 100
103 ms 344 KB
#include <iostream>
using namespace std;

pair<pair<int, int>, pair<int, int>> arr[20];

bool xd[10005];

int main() {
	
	int n, m, a, b, c, d;
	
	cin >> n >> m;
	
	for(int i=0; i<m; i++) {
		cin >> a >> b >> c >> d;
		
		arr[i] = {{a, b}, {c, d}};
	}
	
	long long cost;
	long long res = 1000000000000000;
	
	int dd;
	
	for(int i=1; i<(1<<m); i++) {
		
		for(int j=0; j<=n; j++) {
			xd[j] = false;
		}
		
		cost = 0;
		
		for(int j=0; j<m; j++) {
			if(i & (1<<j)) {
				cost+=arr[j].second.second;
			
				for(int k = arr[j].first.first; k<=arr[j].first.second; k++) {
					xd[k] = true;
				}
				
				xd[arr[j].second.first] = false;
			}
		}
		
		dd = 0;
		
		for(int j=1; j<=n; j++) {
			if(xd[j] == false) {
				dd++;
			}
		}
		
		if(dd == 1) {
			res = min(res, cost);
		}
	}
	
	if(res != 1000000000000000) {
		cout << res;
	}
	else {
		cout << -1;
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 103 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 103 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 103 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 103 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -