Submission #1050641

# Submission time Handle Problem Language Result Execution time Memory
1050641 2024-08-09T12:03:47 Z pawned Wiring (IOI17_wiring) C++17
13 / 100
25 ms 6096 KB
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;

#include "wiring.h"

ll min_total_length(vector<int> r_g, vector<int> b_g) {
	vi r, b;
	for (int x : r_g)
		r.pb(x);
	for (int x : b_g)
		b.pb(x);
	int N = r.size();
	int M = b.size();
	ll total = 0;
	if (N <= M) {	// more b than r
		for (int i = 0; i < N; i++) {
			total += (b[i] - r[i]);
		}
		for (int i = N; i < M; i++) {
			total += (b[i] - r[N - 1]);
		}
	}
	else {	// more r than b
		for (int i = 0; i < M; i++) {
			total += (b[i] - r[i]);
		}
		for (int i = M; i < N; i++) {
			total += (b[0] - r[i]);
		}
	}
	return total;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 3rd lines differ - on the 1st token, expected: '25859', found: '-4909'
2 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 Correct 11 ms 4584 KB Output is correct
4 Correct 23 ms 4552 KB Output is correct
5 Correct 11 ms 4600 KB Output is correct
6 Correct 14 ms 6096 KB Output is correct
7 Correct 25 ms 6060 KB Output is correct
8 Correct 16 ms 6068 KB Output is correct
9 Correct 14 ms 6096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB 3rd lines differ - on the 1st token, expected: '17703', found: '-19052'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 3rd lines differ - on the 1st token, expected: '27', found: '12'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 3rd lines differ - on the 1st token, expected: '25859', found: '-4909'
2 Halted 0 ms 0 KB -