Guest User

Untitled

a guest
Feb 6th, 2021
172
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. #define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
  3. #define F first
  4. #define S second
  5. #define V vector
  6. #define PB push_back
  7. #define MP make_pair
  8. #define EB emplace_back
  9. #define ALL(v) (v).begin(), (v).end()
  10. #define debug(x) cerr << "Line(" << __LINE__ << ") -> " << #x << " is " << x << endl
  11.  
  12. using namespace std;
  13.  
  14. typedef long long ll;
  15. typedef pair<int, int> pi;
  16. typedef V<int> vi;
  17.  
  18. const int INF = 1e9 + 7, N = 1e5 + 7;
  19.  
  20. double a[N][30], sum[N], mean[N], d[N];
  21.  
  22. signed main()
  23. {
  24.     IO_OP;
  25.  
  26.     int n, m, b;
  27.     cin >> n >> m >> b;
  28.     for(int i = 0; i < n; i++) {
  29.         for(int j = 0; j < m; j++) {
  30.             cin >> a[i][j];
  31.             sum[j] += a[i][j];
  32.         }
  33.     }
  34.     for(int i = 0; i < m; i++) {
  35.         mean[i] = sum[i] / n;
  36.         double tt = 0;
  37.         for(int j = 0; j < n; j++) {
  38.             tt += (a[j][i] - mean[i]) * (a[j][i] - mean[i]);
  39.         }
  40.         tt /= (n - 1);
  41.         d[i] = tt;
  42.     }
  43.     auto go = [&](V<double> c) -> double {
  44.         assert(c.size() == m);
  45.         double p = 0;
  46.         for(int j = 0; j < n; j++) {
  47.             if(abs(mean[j] - c[j]) > 2 * d[j]) {
  48.                 p -= 1.30102999566; // log 0.05
  49.             } else {
  50.                 p -= 0.02227639471; // log 0.95
  51.             }
  52.         }
  53.         return p;
  54.     };
  55.     V<pair<double, int>> ans;
  56.     for(int i = 0; i < n; i++) {
  57.         V<double> c(m);
  58.         for(int j = 0; j < m; j++)
  59.             c[j] = a[i][j];
  60.         double p1 = go(c);
  61.         reverse(ALL(c));
  62.         double p2 = go(c);
  63.         ans.EB(p1 - p2, i);
  64.     }
  65.     sort(ALL(ans));
  66.     for(int i = 0; i < b; i++)
  67.         cout << ans[i].S + 1 << '\n';
  68.  
  69. }
  70.  
  71.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×