Submission #822945

# Submission time Handle Problem Language Result Execution time Memory
822945 2023-08-12T05:42:58 Z mindiyak Wiring (IOI17_wiring) C++14
13 / 100
19 ms 1864 KB
#include "wiring.h"
#include <queue>
#include <algorithm>
#include <iostream>
using namespace std;

#define ll long long

long long min_total_length(std::vector<int> r, std::vector<int> b) {
	ll ans=0;

	int b_counter=0,r_counter = 0;
	for(int i=0;i<r.size();i++){
		if(b_counter >= b.size()){
			ans += abs(r[i]-b[0]);
		}else{
			ans += abs(r[i]-b[b_counter]);
		}
		b_counter++;
	}
	for(int i=b_counter;i<b.size();i++){
		ans += abs(r[r.size()-1]-b[i]);
	}


	return ans;
}

Compilation message

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:13:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |  for(int i=0;i<r.size();i++){
      |              ~^~~~~~~~~
wiring.cpp:14:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |   if(b_counter >= b.size()){
      |      ~~~~~~~~~~^~~~~~~~~~~
wiring.cpp:21:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for(int i=b_counter;i<b.size();i++){
      |                      ~^~~~~~~~~
wiring.cpp:12:18: warning: unused variable 'r_counter' [-Wunused-variable]
   12 |  int b_counter=0,r_counter = 0;
      |                  ^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 3rd lines differ - on the 1st token, expected: '25859', found: '26399'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 14 ms 1412 KB Output is correct
4 Correct 14 ms 1364 KB Output is correct
5 Correct 13 ms 1404 KB Output is correct
6 Correct 18 ms 1856 KB Output is correct
7 Correct 19 ms 1864 KB Output is correct
8 Correct 18 ms 1844 KB Output is correct
9 Correct 18 ms 1860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 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 1 ms 212 KB 3rd lines differ - on the 1st token, expected: '27', found: '30'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 3rd lines differ - on the 1st token, expected: '25859', found: '26399'
2 Halted 0 ms 0 KB -