Submission #20905064


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, l, r) for (int i = l; i <= (int)(r); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define all(v) v.begin(), v.end()
#define MOD (int) (1e9+7)
#define INF (int) 1e9
#define LLINF (ll) 1e18

int main(){
	int n, m, q;
	cin >> n >> m >> q;

	vector<P> ps(n);
	rep(i, n){
		cin >> ps[i].second >> ps[i].first;
		ps[i].first = -ps[i].first;
	}

	sort(all(ps));

	rep(i, n){
		ps[i].first = -ps[i].first;
	}

	vector<int> x(m);
	rep(i, m) cin >> x[i];

	rep(qi, q){
		vector<int> ms;

		int l, r;
		cin >> l >> r;
		rep(i, m){
			if(i<=l-2 || r<=i) ms.emplace_back(x[i]);
		}

		sort(all(ms));

		int ans = 0;
		int mcnt = m-(r-l+1);
		for (int i = 0; i <mcnt ; i++){
			rep(j, ms.size()){
				if(ms[j] >= ps[i].second){
					ans += ps[i].first;
					ms.erase(ms.begin()+j);
					break;
				}
			}
		}
		
		cout << ans << endl;	
	}
	// printf("%d\n", N);
	return 0;
}

Submission Info

Submission Time
Task D - Shipping Center
User pontsuyo
Language C++ (GCC 9.2.1)
Score 0
Code Size 1110 Byte
Status WA
Exec Time 9 ms
Memory 3608 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 1
AC × 12
WA × 19
Set Name Test Cases
Sample sample_01.txt
All hand_01.txt, hand_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_31.txt, random_32.txt, random_33.txt, random_34.txt, sample_01.txt
Case Name Status Exec Time Memory
hand_01.txt AC 9 ms 3392 KiB
hand_02.txt AC 3 ms 3388 KiB
random_01.txt WA 2 ms 3580 KiB
random_02.txt WA 1 ms 3528 KiB
random_03.txt WA 2 ms 3416 KiB
random_04.txt WA 2 ms 3472 KiB
random_05.txt WA 2 ms 3516 KiB
random_06.txt AC 2 ms 3576 KiB
random_07.txt WA 3 ms 3516 KiB
random_08.txt WA 2 ms 3592 KiB
random_11.txt AC 2 ms 3584 KiB
random_12.txt AC 2 ms 3464 KiB
random_13.txt WA 2 ms 3580 KiB
random_14.txt AC 2 ms 3384 KiB
random_15.txt WA 3 ms 3608 KiB
random_16.txt AC 2 ms 3572 KiB
random_17.txt WA 3 ms 3576 KiB
random_18.txt WA 2 ms 3392 KiB
random_19.txt WA 2 ms 3472 KiB
random_20.txt WA 2 ms 3448 KiB
random_21.txt WA 2 ms 3472 KiB
random_22.txt WA 2 ms 3512 KiB
random_23.txt WA 7 ms 3528 KiB
random_24.txt WA 2 ms 3576 KiB
random_25.txt WA 2 ms 3396 KiB
random_26.txt WA 2 ms 3588 KiB
random_31.txt AC 2 ms 3572 KiB
random_32.txt AC 2 ms 3460 KiB
random_33.txt AC 2 ms 3512 KiB
random_34.txt AC 6 ms 3444 KiB
sample_01.txt AC 2 ms 3464 KiB