about summary refs log tree commit diff
path: root/tht/C/TP-2018/mab.cpp
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2020-06-06 21:33:13 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2020-06-06 21:33:13 +0700
commit2f674dc80f0382f1c3178f435714960734dc9d3c (patch)
tree2abba7e4ec72bd16f58f7375126144d3fd9f4bca /tht/C/TP-2018/mab.cpp
parentb2d80610db6beda38573890ed169815e495bc663 (diff)
downloadcp-2f674dc80f0382f1c3178f435714960734dc9d3c.tar.gz
Reorganize stuff from secondary school
Diffstat (limited to 'tht/C/TP-2018/mab.cpp')
-rw-r--r--tht/C/TP-2018/mab.cpp77
1 files changed, 0 insertions, 77 deletions
diff --git a/tht/C/TP-2018/mab.cpp b/tht/C/TP-2018/mab.cpp
deleted file mode 100644
index 7b8dbb8..0000000
--- a/tht/C/TP-2018/mab.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <iostream>
-#include <fstream>
-#include <set>
-#include <vector>
-using namespace std;
-
-int
-main()
-{
-  ifstream infile;
-  infile.open("MAB.INP");
-  int m, n, k;
-  infile >> m >> n >> k;
-
-  int i, j;
-  long tmp;
-  vector<vector<long>> a;
-  a.resize(m);
-  vector<set<long>> r;
-  r.resize(m);
-  vector<set<long>> c;
-  c.resize(n);
-  for (i = 0; i < m; i++)
-    for (j = 0; j < n; j++)
-      {
-        infile >> tmp;
-        a[i].push_back(tmp);
-        r[i].insert(tmp);
-        c[j].insert(tmp);
-      }
-
-  vector<vector<long>> rows, columns;
-  rows.resize(m);
-  for (i = 0; i < m; i++)
-    for (auto& item : r[i])
-      rows[i].push_back(item);
-  columns.resize(n);
-  for (i = 0; i < n; i++)
-    for (auto& item : c[i])
-      columns[i].push_back(item);
-
-  int alpha, beta;
-  vector<vector<long>> mem;
-  mem.resize(m);
-  for (i = 0; i < m; i++)
-    mem[i].resize(n);
-  for (i = 0; i < m; i++)
-    for (j = 0; j < n; j++)
-      {
-        tmp = a[i][j];
-        alpha = lower_bound(rows[i].begin(), rows[i].end(), tmp) - rows[i].begin();
-        beta = lower_bound(columns[j].begin(), columns[j].end(), tmp) - columns[j].begin();
-        mem[alpha][n - beta - 1]++;
-      }
-  for (i = 0; i < m; i++)
-    for (j = 1; j < n; j++)
-      mem[i][j] += mem[i][j - 1];
-  for (i = 1; i < m; i++)
-    for (j = 0; j < n; j++)
-      mem[i][j] += mem[i - 1][j];
-
-  ofstream outfile;
-  outfile.open("MAB.OUT");
-  while (k--)
-    {
-      infile >> alpha >> beta;
-      if (alpha == m)
-        alpha--;
-      if (beta == n)
-        beta--;
-      outfile << mem[alpha][beta] << endl;
-    }
-
-  infile.close();
-  outfile.close();
-  return 0;
-}