Submission #55058883


Source Code Expand

Copy
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n;
cin >> n;
vector<long long> items(n + 1);
vector<pair<long long, long long>> a(n);
long long sum = 0;
for (int i = 0; i < n; ++i) {
cin >> a[i].first;
}
for (int i = 0; i < n; ++i) {
cin >> a[i].second;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	int n;
	cin >> n;
	vector<long long> items(n + 1);
	vector<pair<long long, long long>> a(n);
	long long sum = 0;
	for (int i = 0; i < n; ++i) {
		cin >> a[i].first;
	}
	for (int i = 0; i < n; ++i) {
		cin >> a[i].second;
		sum += a[i].second;
		sum += items[a[i].first];
		items[a[i].first] = max(items[a[i].first], a[i].second);
		sum -= items[a[i].first];
	}
	cout << sum << '\n';
}

Submission Info

Submission Time
Task C - Move It
User N00BGH0ST
Language C++ 20 (gcc 12.2)
Score 250
Code Size 685 Byte
Status AC
Exec Time 10 ms
Memory 5568 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 250 / 250
Status
AC × 2
AC × 23
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 02_corner_00.txt, 02_corner_01.txt, 02_corner_02.txt, 02_corner_03.txt, 02_corner_04.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3548 KB
00_sample_01.txt AC 1 ms 3496 KB
01_random_00.txt AC 10 ms 5380 KB
01_random_01.txt AC 5 ms 4108 KB
01_random_02.txt AC 10 ms 5396 KB
01_random_03.txt AC 8 ms 4796 KB
01_random_04.txt AC 10 ms 5448 KB
01_random_05.txt AC 5 ms 4164 KB
01_random_06.txt AC 10 ms 5388 KB
01_random_07.txt AC 8 ms 5108 KB
01_random_08.txt AC 10 ms 5568 KB
01_random_09.txt AC 10 ms 5464 KB
01_random_10.txt AC 10 ms 5516 KB
01_random_11.txt AC 4 ms 3844 KB
01_random_12.txt AC 10 ms 5424 KB
01_random_13.txt AC 8 ms 4864 KB
01_random_14.txt AC 10 ms 5424 KB
01_random_15.txt AC 8 ms 4924 KB
02_corner_00.txt AC 5 ms 4324 KB
02_corner_01.txt AC 10 ms 5376 KB
02_corner_02.txt AC 9 ms 5376 KB
02_corner_03.txt AC 8 ms 5152 KB
02_corner_04.txt AC 8 ms 5388 KB


2025-02-27 (Thu)
22:43:46 +00:00