Submission details
Task:Keke's delivery service
Sender:aalto26jw_006
Submission time:2026-11-11 17:48:12 +0200
Language:C++ (C++23)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'void solve()':
input/code.cpp:71:17: error: redeclaration of 'int q'
   71 |             int q=2*i+st;
      |                 ^
input/code.cpp:67:17: note: 'int q' previously declared here
   67 |             int q=2*i+st;
      |                 ^
input/code.cpp: At global scope:
input/code.cpp:75:14: error: 'full' was not declared in this scope; did you mean 'fmull'?
   75 |     int done=full-1;
      |              ^~~~
      |              fmull
input/code.cpp:8:22: error: expected unqualified-id before 'for'
    8 | #define FOR(i, a, b) for(__typeof(b) i = a, _b = b; i <= _b; ++i)
      |                      ^~~
input/code.cpp:77:5: note: in expansion of macro 'FOR'
   77 |     FOR(p,0,2*n-1) ans=min(ans, dp[done][p]+dist(px[p],py[p],0,0));
      |     ^~~
input/code.cpp:77:9: error: 'p' does not name a type; did you mean 'pb'?
   77 |     FOR(p,0,2*n-1) ans=min(ans, dp[done][p]+dist(px[p],py[p],0,0));
      |         ^
input/code.cpp:8:53: note: in...

Code

// #ifdef ONLINE_JUDGE
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
// #endif
#include "bits/stdc++.h"
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define FOR(i, a, b) for(__typeof(b) i = a, _b = b; i <= _b; ++i)
#define FORD(i, a, b) for(__typeof(a) i = a, _b = b; i >= _b; --i)
#define ALL(a) (a).begin(), (a).end()
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define ll long long
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define ii pair<int,int>
#define iii pair<int,pair<int,int>>
#define dq deque<int>
#define nend '\n'
using namespace std;

const ll inf = 1e18;
const int dx[] = {1,0,-1,0};
const int dy[] = {0,1,0,-1};
const int MOD = 1e9 + 7;
const ll hashi = 2e9 + 11;

void init_code() {
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
const int N=10, S=59049;
int n;
double px[2*N], py[2*N];  
double dp[S][2*N];
int pw3[N+1];

double dist(double x1, double y1, double x2, double y2) { return hypot(x1-x2, y1-y2); }

/// 0: not picked up 
/// 1: on the scooter 
/// 2: delivered
// dp[0..2][p] = shortest path from home that reaches this state, standing at point p
void solve() {
    cin >> n;
    FOR(i,0,n-1) cin >> px[2*i] >> py[2*i] >> px[2*i+1] >> py[2*i+1];
    pw3[0]=1;
    FOR(i,1,n) pw3[i]=pw3[i-1]*3;
    int full=pw3[n];
    FOR(s,0,full-1) FOR(p,0,2*n-1) dp[s][p]=1e30;

    FOR(i,0,n-1) dp[pw3[i]][2*i] = dist(0,0,px[2*i],py[2*i]);  

    FOR(s,1,full-1) FOR(p,0,2*n-1) {
        double cur=dp[s][p];
        if (cur>=1e12) continue;
        FOR(i,0,n-1) {
            int st=s/pw3[i]%3;
            if (st==2) continue;
            /// st 1 then pick up
            /// st 2 then deliver
            int q=2*i+st;  
            double nd=cur+dist(px[p],py[p],px[q],py[q]);
            double& t=dp[s+pw3[i]][q];
            if (nd<t) t=nd;
            int q=2*i+st;
            }
        }
    }
    int done=full-1;                        
    double ans=1e30;
    FOR(p,0,2*n-1) ans=min(ans, dp[done][p]+dist(px[p],py[p],0,0));
    cout << fixed << setprecision(10) << ans << nend;
}

int main() {
    init_code();

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}