Submission #72873

#TimeUsernameProblemLanguageResultExecution timeMemory
72873SmsSWiring (IOI17_wiring)C++14
13 / 100
44 ms2156 KiB
#include<bits/stdc++.h>
using namespace std;
#define for2(a,b,c) for(int a=b;a<c;a++)
#define ll long long
#include "wiring.h"

long long min_total_length(std::vector<int> r, std::vector<int> b) {
	ll res = 0;
	int L = 0;
	int R = b.size()-1;
	while(L != r.size() && R != -1){
		res += b[R]-r[L];
		L++;
		R--;
	}
	while(R != -1){
		res += b[R]-r[L-1];
		R--;
	}
	while(L != r.size()){
		res += b[R+1]-r[L];
		L++;
	}
	return res;
}

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:11:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(L != r.size() && R != -1){
        ~~^~~~~~~~~~~
wiring.cpp:20:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(L != r.size()){
        ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...