답안 #712910

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
712910 2023-03-20T12:36:21 Z yuseok0803 Hotel (CEOI11_hot) C++14
10 / 100
705 ms 36588 KB
#include <stdio.h>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stack>
#include <ctype.h>
#define p(x,y) pair<x, y>
#define pii pair<int, int>
#define v(x) vector<x>
#define q(x) queue<x>
#define pq(x) priority_queue<x>
#define uppq(x, comp) priority_queue<x, vector<x>, comp>
#define st(x) set<x>  
#define m(x, y) map<x, y>
#define fi(s,e) for(int i=s;i<e;i++)
#define fj(s,e) for(int j=s;j<e;j++)
#define fk(s,e) for(int k=s;k<e;k++)
typedef long long int ll;
typedef unsigned long long int ull;
typedef __int128 ulll;
using namespace std;

int main(void){
	int n,m,o;
	scanf("%d%d%d",&n,&m,&o);
	multiset<pii> hot;
	multiset<pii>::iterator it;
	v(pii) vec;
	v(ll) ans;
	fi(0,n){
		int c,p;
		scanf("%d%d",&c,&p);
		hot.insert({p,c});
	}
	fi(0,m){
		int v,d;
		scanf("%d%d",&v,&d);
		vec.push_back({v,d});
	}
	
	sort(vec.begin(), vec.end());
	int sz = vec.size();
	
	for(int i = sz-1; i >= 0; i--){
		it = hot.lower_bound({vec[i].second, 0});
		if(it!=hot.end() && (*it).second < vec[i].first){
			ans.push_back({vec[i].first-(*it).second});
			hot.erase(it);
		}
	}
	
	sort(ans.begin(), ans.end());
	ll cor_ans=0;
	sz = ans.size();
	for(int i = sz-1; i >= 0; i--){
		if(sz-i >= o) break;
		cor_ans+=ans[i];
	}
	printf("%lld\n", cor_ans);
	return 0;
}

Compilation message

hot.cpp: In function 'int main()':
hot.cpp:30:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |  scanf("%d%d%d",&n,&m,&o);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~
hot.cpp:37:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |   scanf("%d%d",&c,&p);
      |   ~~~~~^~~~~~~~~~~~~~
hot.cpp:42:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |   scanf("%d%d",&v,&d);
      |   ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 284 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 284 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 47 ms 4380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 7700 KB Output is correct
2 Incorrect 60 ms 6056 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 277 ms 17072 KB Output is correct
2 Incorrect 127 ms 11472 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 627 ms 31052 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 705 ms 36588 KB Output isn't correct
2 Halted 0 ms 0 KB -