제출 #74000

#제출 시각아이디문제언어결과실행 시간메모리
74000haitunCloud Computing (CEOI18_clo)C++14
0 / 100
3 ms588 KiB
#include <bits/stdc++.h>
//#include "functions.h"
#define FOR(x,y) for(int x = 0; x < y; x++)
#define ALLR(x) x.begin(),x.end()
#define con continue
#define ll long long
#define LINF LLONG_MAX
#define INF INT_MAX
#define pii pair<int,int>
#define vi vector <int>
#define pb push_back
#define F first
#define S second
#define len(x) x.length()
#define sz(x) x.size()
#define debug cout << "\nPass line " + to_string(__LINE__) + "\n"
using namespace std;
//#define debug cout << endl
int main() {
    
	int n;
	cin >> n;
	
	vector <tuple<int,int,int> > ac;
	FOR(j, n)
	{
	    int q1,q2,q3;
	    cin >> q1 >> q2 >> q3;
	    ac.push_back(make_tuple(q3,q2,q1));
	}
	sort(ALLR(ac));
	//reverse(ALLR(ac));
	
	int m;
	cin >> m;
	
	vector <tuple<int,int,int> > order(m);
	FOR(j, n)
	{
	    int q1,q2,q3;
	    cin >> q1 >> q2 >> q3;
	    order.push_back(make_tuple(q3,q2,q1));
	}
	sort(ALLR(order));
	reverse(ALLR(order));
	
	int ans = 0;
	
	FOR(j, m)
	{
	    FOR(k, n)
	    {
	        if(get<1>(order[j]) <= get<1>(ac[j]) && get<0>(order[j]) - get<0>(ac[j]) >= 0)
	        {
	            ans += get<0>(order[j]) - get<0>(ac[j]);
	            ac.erase(ac.begin() + k);
	            break;
	        }
	    }
	}
	cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...