Submission #127090

#TimeUsernameProblemLanguageResultExecution timeMemory
127090chubyxdxdWiring (IOI17_wiring)C++11
Compilation error
0 ms0 KiB
#include "wiring.h"
#include <bits/stdc++.h>
typedef int_64 ll;
using namespace std;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
	ll tamr=r.size();
	ll tamb=b.size();
	ll c=0;
	if(r[tamr-1]<b[0]){
		ll i=0;
		ll j=tamr-1;
		ll k=j;
		ll l=i;
		ll sw=0;
		//int c=0;
		ll a,d,e;
		while(sw<(min(tamr,tamb))){
			a=abs(r[j]-b[i]);
			d=abs(r[j]-b[l]);
			e=abs(b[i]-r[k]);
			//cout<<a<<"<"<<d<<"+"<<e<<endl;
			c+=min(a,d+e);
			//cout<<c<<endl;
			i++;
			j--;
			sw++;
		}
		//cout<<j<<" "<<i<<endl;
		if(tamb<tamr){
			//j++;
			for(ll h=j;h>=0;h--){
				c+=abs(r[h]-b[l]);
			}
		}
		else{
			//i--;
			//cout<<tamb<<endl;
			for(ll h=i;h<tamb;h++){
				c+=abs(b[i]-r[k]);
				//cout<<r[h]<<"-"<<b[k]<<"="<<c<<endl;
				//cout<<c<<endl;
			}	
		}
		//cout<<c<<endl;
		return c;
	}
	return c;
}

Compilation message (stderr)

wiring.cpp:3:9: error: 'int_64' does not name a type; did you mean 'wint_t'?
 typedef int_64 ll;
         ^~~~~~
         wint_t
wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:6:2: error: 'll' was not declared in this scope
  ll tamr=r.size();
  ^~
wiring.cpp:7:5: error: expected ';' before 'tamb'
  ll tamb=b.size();
     ^~~~
wiring.cpp:8:5: error: expected ';' before 'c'
  ll c=0;
     ^
wiring.cpp:9:7: error: 'tamr' was not declared in this scope
  if(r[tamr-1]<b[0]){
       ^~~~
wiring.cpp:9:7: note: suggested alternative: 'time'
  if(r[tamr-1]<b[0]){
       ^~~~
       time
wiring.cpp:10:6: error: expected ';' before 'i'
   ll i=0;
      ^
wiring.cpp:11:6: error: expected ';' before 'j'
   ll j=tamr-1;
      ^
wiring.cpp:12:6: error: expected ';' before 'k'
   ll k=j;
      ^
wiring.cpp:13:6: error: expected ';' before 'l'
   ll l=i;
      ^
wiring.cpp:14:6: error: expected ';' before 'sw'
   ll sw=0;
      ^~
wiring.cpp:16:6: error: expected ';' before 'a'
   ll a,d,e;
      ^
wiring.cpp:17:9: error: 'sw' was not declared in this scope
   while(sw<(min(tamr,tamb))){
         ^~
wiring.cpp:17:22: error: 'tamb' was not declared in this scope
   while(sw<(min(tamr,tamb))){
                      ^~~~
wiring.cpp:17:22: note: suggested alternative: 'time'
   while(sw<(min(tamr,tamb))){
                      ^~~~
                      time
wiring.cpp:18:4: error: 'a' was not declared in this scope
    a=abs(r[j]-b[i]);
    ^
wiring.cpp:18:12: error: 'j' was not declared in this scope
    a=abs(r[j]-b[i]);
            ^
wiring.cpp:18:17: error: 'i' was not declared in this scope
    a=abs(r[j]-b[i]);
                 ^
wiring.cpp:19:4: error: 'd' was not declared in this scope
    d=abs(r[j]-b[l]);
    ^
wiring.cpp:19:17: error: 'l' was not declared in this scope
    d=abs(r[j]-b[l]);
                 ^
wiring.cpp:20:4: error: 'e' was not declared in this scope
    e=abs(b[i]-r[k]);
    ^
wiring.cpp:20:17: error: 'k' was not declared in this scope
    e=abs(b[i]-r[k]);
                 ^
wiring.cpp:22:4: error: 'c' was not declared in this scope
    c+=min(a,d+e);
    ^
wiring.cpp:29:6: error: 'tamb' was not declared in this scope
   if(tamb<tamr){
      ^~~~
wiring.cpp:29:6: note: suggested alternative: 'time'
   if(tamb<tamr){
      ^~~~
      time
wiring.cpp:31:11: error: expected ';' before 'h'
    for(ll h=j;h>=0;h--){
           ^
wiring.cpp:31:15: error: 'h' was not declared in this scope
    for(ll h=j;h>=0;h--){
               ^
wiring.cpp:32:5: error: 'c' was not declared in this scope
     c+=abs(r[h]-b[l]);
     ^
wiring.cpp:32:19: error: 'l' was not declared in this scope
     c+=abs(r[h]-b[l]);
                   ^
wiring.cpp:38:11: error: expected ';' before 'h'
    for(ll h=i;h<tamb;h++){
           ^
wiring.cpp:38:15: error: 'h' was not declared in this scope
    for(ll h=i;h<tamb;h++){
               ^
wiring.cpp:39:5: error: 'c' was not declared in this scope
     c+=abs(b[i]-r[k]);
     ^
wiring.cpp:39:14: error: 'i' was not declared in this scope
     c+=abs(b[i]-r[k]);
              ^
wiring.cpp:39:19: error: 'k' was not declared in this scope
     c+=abs(b[i]-r[k]);
                   ^
wiring.cpp:45:10: error: 'c' was not declared in this scope
   return c;
          ^
wiring.cpp:47:9: error: 'c' was not declared in this scope
  return c;
         ^