fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define F first
  5. #define S second
  6. const int mod = 1e9 + 7;
  7. const int N = 2e5 + 10;
  8. pair<int,int>arr[105];
  9. int n , k , vist[105][(1 << 11)];
  10. long double dp[105][(1 << 11)];
  11. long double dist(int &a , int &b)
  12. {
  13. return (long double)hypot(arr[b].S - arr[a].S , arr[b].F - arr[a].F);
  14. }
  15. long double rec(int ind , int bit)
  16. {
  17. if((1 << k)-1 == bit)
  18. return 0;
  19. if (vist[ind][bit])return dp[ind][bit];
  20. vist[ind][bit] = 1;
  21. long double minn = 1e9;
  22. for(int j = 0 ; j < k ; ++j)
  23. if (((bit >> j)&1) == 0)
  24. minn = min(minn , rec(ind , bit | (1 << j))+dist(ind , j));
  25. for (int i = k ; i < n ; ++i)
  26. {
  27. for (int j = 0 ; j < k ; ++j)
  28. if ((((bit >> j)&1) == 0))
  29. minn = min(minn , rec(i , bit | (1 << j))+dist(i , j)+dist(ind , i));
  30. }
  31. return dp[ind][bit] = minn;
  32. }
  33. int main ()
  34. {
  35. cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
  36. cin >> n >> k;
  37. for (int i = 0 ; i < n ; ++i)
  38. cin >> arr[i].F >> arr[i].S;
  39. long double ans = 1e9;
  40. for(int i = k ; i < n ; ++i)
  41. {
  42. memset(vist , 0 , sizeof vist);
  43. for (int j = 0 ; j < k ; ++j)
  44. ans = min(ans , rec(i , (1 << j))+dist(i , j));
  45. }
  46.  
  47. printf("%.5LF\n" , ans);
  48. return 0;
  49. }
  50.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, or enum expected
#include <bits/stdc++.h>
         ^
Main.java:3: error: illegal character: '#'
#define ll long long
^
Main.java:3: error: class, interface, or enum expected
#define ll long long
        ^
Main.java:4: error: illegal character: '#'
#define F first
^
Main.java:5: error: illegal character: '#'
#define S second
^
Main.java:7: error: class, interface, or enum expected
const int N = 2e5 + 10;
^
Main.java:8: error: class, interface, or enum expected
pair<int,int>arr[105];
^
Main.java:9: error: class, interface, or enum expected
int n , k , vist[105][(1 << 11)];
^
Main.java:10: error: class, interface, or enum expected
long double dp[105][(1 << 11)];
^
Main.java:11: error: class, interface, or enum expected
long double dist(int &a , int &b)
^
Main.java:14: error: class, interface, or enum expected
}
^
Main.java:19: error: class, interface, or enum expected
    if (vist[ind][bit])return dp[ind][bit];
    ^
Main.java:20: error: class, interface, or enum expected
    vist[ind][bit] = 1;
    ^
Main.java:21: error: class, interface, or enum expected
    long double minn = 1e9;
    ^
Main.java:22: error: class, interface, or enum expected
    for(int j = 0 ; j < k ; ++j)
    ^
Main.java:22: error: class, interface, or enum expected
    for(int j = 0 ; j < k ; ++j)
                    ^
Main.java:22: error: class, interface, or enum expected
    for(int j = 0 ; j < k ; ++j)
                            ^
Main.java:25: error: class, interface, or enum expected
    for (int i =  k ; i < n ; ++i)
    ^
Main.java:25: error: class, interface, or enum expected
    for (int i =  k ; i < n ; ++i)
                      ^
Main.java:25: error: class, interface, or enum expected
    for (int i =  k ; i < n ; ++i)
                              ^
Main.java:27: error: class, interface, or enum expected
        for (int j =  0 ; j <  k ; ++j)
                          ^
Main.java:27: error: class, interface, or enum expected
        for (int j =  0 ; j <  k ; ++j)
                                   ^
Main.java:30: error: class, interface, or enum expected
    }
    ^
Main.java:32: error: class, interface, or enum expected
}
^
Main.java:35: error: class, interface, or enum expected
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
               ^
Main.java:35: error: class, interface, or enum expected
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
                           ^
Main.java:36: error: class, interface, or enum expected
    cin >> n >> k;
    ^
Main.java:37: error: class, interface, or enum expected
    for (int i = 0 ; i < n ; ++i)
    ^
Main.java:37: error: class, interface, or enum expected
    for (int i = 0 ; i < n ; ++i)
                     ^
Main.java:37: error: class, interface, or enum expected
    for (int i = 0 ; i < n ; ++i)
                             ^
Main.java:39: error: class, interface, or enum expected
    long double ans = 1e9;
    ^
Main.java:40: error: class, interface, or enum expected
    for(int i = k ; i < n ; ++i)
    ^
Main.java:40: error: class, interface, or enum expected
    for(int i = k ; i < n ; ++i)
                    ^
Main.java:40: error: class, interface, or enum expected
    for(int i = k ; i < n ; ++i)
                            ^
Main.java:43: error: class, interface, or enum expected
        for (int j = 0 ; j < k ; ++j)
        ^
Main.java:43: error: class, interface, or enum expected
        for (int j = 0 ; j < k ; ++j)
                         ^
Main.java:43: error: class, interface, or enum expected
        for (int j = 0 ; j < k ; ++j)
                                 ^
Main.java:45: error: class, interface, or enum expected
    }
    ^
Main.java:48: error: class, interface, or enum expected
return 0;
^
Main.java:49: error: class, interface, or enum expected
}
^
41 errors
stdout
Standard output is empty