Submission #45343

# Submission time Handle Problem Language Result Execution time Memory
45343 2018-04-13T01:20:59 Z Mamnoon_Siam Wiring (IOI17_wiring) C++17
13 / 100
54 ms 12936 KB
#include <bits/stdc++.h>
using namespace std;
#include "wiring.h"

long long min_total_length(std::vector<int> r, std::vector<int> b) {
	sort(r.begin(), r.end());
	sort(b.begin(), b.end());
	long long ret = 0;
	for(int i=0; i<r.size(); i++) ret += r.back() - r[i];
	for(int i=0; i<b.size(); i++) ret += b[i] - b[0];
	ret += max(r.size(), b.size()) * (b[0] - r.back());
	return ret;
}

Compilation message

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:9:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<r.size(); i++) ret += r.back() - r[i];
               ~^~~~~~~~~
wiring.cpp:10:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<b.size(); i++) ret += b[i] - b[0];
               ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 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 2 ms 488 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 32 ms 1588 KB Output is correct
4 Correct 34 ms 3028 KB Output is correct
5 Correct 31 ms 4544 KB Output is correct
6 Correct 40 ms 6936 KB Output is correct
7 Correct 41 ms 9068 KB Output is correct
8 Correct 54 ms 11136 KB Output is correct
9 Correct 40 ms 12936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 12936 KB Output is correct
2 Incorrect 2 ms 12936 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 2 ms 12936 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 2 ms 376 KB 3rd lines differ - on the 1st token, expected: '25859', found: '-4909'
2 Halted 0 ms 0 KB -