Submission #767327

#TimeUsernameProblemLanguageResultExecution timeMemory
767327APROHACKWiring (IOI17_wiring)C++14
Compilation error
0 ms0 KiB
#include "wiring.h"
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define ll long long
using namespace std;

long long min_total_length(std::vector<int> r, std::vector<int> b) {
	int ir = r.size() -1 ; ib = 0;
	ll ans = 0;
	while(ir >= 0 and ib < b.size()){
		ans += b[ib] - r[ir];
		ir--;
		ib++;
	}
	while(ir >= 0){
		ans += b[0] - r[ir];
		ir--;
	}
	while(ib < b.size()){
		ans += b[ib] - r.back();
		ib++;
	}
	
	
	return ans;
}

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:10:25: error: 'ib' was not declared in this scope; did you mean 'ir'?
   10 |  int ir = r.size() -1 ; ib = 0;
      |                         ^~
      |                         ir