Submission #42742

# Submission time Handle Problem Language Result Execution time Memory
42742 2018-03-03T16:35:35 Z nonocut Wiring (IOI17_wiring) C++14
0 / 100
2 ms 708 KB
//Subtask 2
#include "wiring.h"
#include<bits/stdc++.h>
using namespace std;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
	long long ans = 0;
	for(auto x : r) ans -= x;
	for(auto x : b) ans += x;
	if(r.size()<b.size()) {
		for(int i=0;i<b.size()-r.size();i++) ans += b[0];
	}
	else {
		for(int i=0;i<r.size()-b.size();i++) ans -= r[0];
	}
	return ans;
}

Compilation message

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:10:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<b.size()-r.size();i++) ans += b[0];
                ^
wiring.cpp:13:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<r.size()-b.size();i++) ans -= r[0];
                ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 248 KB 3rd lines differ - on the 1st token, expected: '25859', found: '-9583'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 484 KB 3rd lines differ - on the 1st token, expected: '904', found: '619'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 484 KB Output is correct
2 Incorrect 2 ms 708 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 708 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 1 ms 248 KB 3rd lines differ - on the 1st token, expected: '25859', found: '-9583'
2 Halted 0 ms 0 KB -