Submission #1090988

#TimeUsernameProblemLanguageResultExecution timeMemory
1090988elotelo966Wiring (IOI17_wiring)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "wiring.h"

using namespace std;
#define OYY LLONG_MAX
#define mod 1000000007
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define lim 2000005
#define fi first
#define se second

typedef long long lo;

int a[lim],bt[lim];

long long min_total_length(std::vector<int> r, std::vector<int> b) {
    int n=a.size();
    int m=b.size();
    for(int i=0;i<n;i++)a[i+1]=r[i];
    for(int i=0;i<m;i++)bt[i+1]=b[i];
    if(n>m){
		swap(n,m);
		swap(a,bt);
	}
	
	lo cev=0;
	
	FOR{
		cev+=abs(a[i]-bt[i]);
	}
	
	int cur=1;
	
	for(int i=n+1;i<=m;i++){
		while(cur<n && a[cur]<bt[i])cur++;
		int tut=abs(a[cur]-bt[i]);
		if(cur!=1)tut=min(tut,abs(a[cur-1]-bt[i]));
		cev+=tut;
	}
	
	return cev;
}

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:19:13: error: request for member 'size' in 'a', which is of non-class type 'int [2000005]'
   19 |     int n=a.size();
      |             ^~~~