Submission #1083132

# Submission time Handle Problem Language Result Execution time Memory
1083132 2024-09-02T16:01:36 Z damamila Palembang Bridges (APIO15_bridge) C++17
22 / 100
32 ms 6740 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);  
	int k, n;
	cin >> k >> n;
	int m = n;
	vector<tuple<int, int, int>> num;
	vector<int> all;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int a, b;
		char c, d;
		cin >> c >> a >> d >> b;
		if (c == d) {
			m--;
			ans += abs(b-a);
		} else {
			ans++;
			all.push_back(a);
			all.push_back(b);
			num.push_back({a+b, a, b});
		}
	}
	//~ if (k == 1) {
		sort(all.begin(), all.end());
		int x = all[all.size()/2];
		for (int i : all) {
			ans += abs(i-x);
		}
		cout << ans << endl;
	//~ } else {
		//~ sort(num.begin(), num.end());
	//~ }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 552 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 468 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 15 ms 5460 KB Output is correct
13 Correct 32 ms 6740 KB Output is correct
14 Correct 24 ms 5720 KB Output is correct
15 Correct 19 ms 4056 KB Output is correct
16 Correct 20 ms 5976 KB Output is correct
17 Correct 24 ms 6736 KB Output is correct
18 Correct 25 ms 6232 KB Output is correct
19 Correct 30 ms 6732 KB Output is correct
20 Correct 21 ms 6280 KB Output is correct
21 Correct 27 ms 6484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -