about summary refs log tree commit diff
path: root/12/QG-2008/seqgame.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 /12/QG-2008/seqgame.cpp
parentb2d80610db6beda38573890ed169815e495bc663 (diff)
downloadcp-2f674dc80f0382f1c3178f435714960734dc9d3c.tar.gz
Reorganize stuff from secondary school
Diffstat (limited to '12/QG-2008/seqgame.cpp')
-rw-r--r--12/QG-2008/seqgame.cpp59
1 files changed, 0 insertions, 59 deletions
diff --git a/12/QG-2008/seqgame.cpp b/12/QG-2008/seqgame.cpp
deleted file mode 100644
index b1751c7..0000000
--- a/12/QG-2008/seqgame.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include <iostream>
-#include <fstream>
-#include <set>
-
-#define ABS(x) ((x < 0) ? -x : x)
-
-using namespace std;
-
-int
-main()
-{
-  ifstream infile;
-  ofstream outfile;
-  short n;
-  long i, c, min = 2e9, a;
-  set<long> b;
-  std::set<long>::iterator k;
-
-  infile.open("SEQGAME.INP");
-  infile >> n;
-  for (i = 0; i < n; i++)
-    {
-      infile >> c;
-      b.insert(c);
-    }
-
-  for (; n--;)
-    {
-      infile >> c;
-      k = b.lower_bound(-c);
-      if (*k == -c)
-        {
-          min = 0;
-          break;
-        }
-
-      if (k != b.end())
-        {
-          i = ABS(*k + c);
-          if (a < min)
-            min = i;
-        }
-
-      if (k != b.begin())
-        {
-          k--;
-          i = ABS(*k + c);
-          if (a < min)
-            min = i;
-        }
-    }
-  infile.close();
-
-  outfile.open("SEQGAME.OUT");
-  outfile << min << endl;
-  outfile.close();
-
-  return 0;
-}