Submission #72627

# Submission time Handle Problem Language Result Execution time Memory
72627 2018-08-26T12:41:33 Z idan_izmirli Wiring (IOI17_wiring) C++14
13 / 100
52 ms 14320 KB
#include "wiring.h"

using namespace std;


long long inline mmin(long long a,long long b)
{
	if(a<b)
	{
		return a;
	}
	return b;
}

long long min_total_length(std::vector<int> r, std::vector<int> b) {
	long long result=0;
	long long blue,red;
	for(int i=0;(i<r.size())||(i<b.size());i++)
	{
		if(i>=r.size())
		{
			red=r[r.size()-1];
		}
		else
		{
			red=r[i];
		}
		if(i>=b.size())
		{
			blue=b[0];
		}
		else
		{
			blue=b[b.size()-1-i];
		}
		result+=blue-red;
	}
	return result;
}

Compilation message

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:18:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;(i<r.size())||(i<b.size());i++)
               ~^~~~~~~~~
wiring.cpp:18:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;(i<r.size())||(i<b.size());i++)
                             ~^~~~~~~~~
wiring.cpp:20:7: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(i>=r.size())
      ~^~~~~~~~~~
wiring.cpp:28:7: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(i>=b.size())
      ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 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 404 KB Output is correct
2 Correct 3 ms 436 KB Output is correct
3 Correct 32 ms 3108 KB Output is correct
4 Correct 52 ms 4644 KB Output is correct
5 Correct 32 ms 6124 KB Output is correct
6 Correct 39 ms 8492 KB Output is correct
7 Correct 38 ms 10460 KB Output is correct
8 Correct 41 ms 12404 KB Output is correct
9 Correct 48 ms 14320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 14320 KB Output is correct
2 Incorrect 3 ms 14320 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 14320 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 256 KB 3rd lines differ - on the 1st token, expected: '25859', found: '-4909'
2 Halted 0 ms 0 KB -