yeputons

Untitled

Jul 11th, 2012
177
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <cstring>
  4. #include <cmath>
  5. #include <cassert>
  6. #include <algorithm>
  7. #include <string>
  8. #include <vector>
  9. #include <deque>
  10. #include <queue>
  11. #include <map>
  12. #include <set>
  13. #include "office.h"
  14.  
  15. using namespace std;
  16.  
  17. #define eprintf(...) fprintf(stderr, __VA_ARGS__)
  18. #define pb push_back
  19. #define mp make_pair
  20. #define sz(x) ((int)(x).size())
  21.  
  22. typedef long long ll;
  23. typedef vector<ll> vll;
  24. typedef vector<int> vi;
  25. typedef vector<vi> vvi;
  26. typedef vector<bool> vb;
  27. typedef vector<vb> vvb;
  28. typedef pair<int, int> pii;
  29.  
  30. bool check(int a, int b, int c) { return isOnLine(a + 1, b + 1, c + 1); }
  31.  
  32. int main() {
  33.   #ifdef DEBUG
  34.   freopen("std.in", "r", stdin);
  35.   freopen("std.out", "w", stdout);
  36.   #endif
  37.  
  38.   int n = GetN();
  39.   int a = -1, b = -1, c = -1;
  40.   for (int st = 0; st < 5; st += 2) {
  41.     a = st;
  42.     b = (st + 1) % 5;
  43.     c = (st + 2) % 5;
  44.     if (st == 4) goto found;
  45.     if (check(a, b, c)) { goto found; }
  46.   }
  47.  
  48.   for (a = 0; a < 5; a++)
  49.   for (b = a + 1; b < 5; b++)
  50.   for (c = b + 1; c < 5; c++)
  51.     if (check(a, b, c)) {
  52.       int x = 0;
  53.       while (x == a || x == b || x == c) x++;
  54.       int y = 10 - a - b - c - x;
  55.       Answer(a + 1, b + 1, x + 1, y + 1);
  56.     }
  57.   found:;
  58.  
  59.   vi rem;
  60.   for (int i = 0; i < n; i++) if (i != a && i != b && i != c) rem.pb(i);
  61.  
  62.   vi second;
  63.   for (int i = 0; i < sz(rem) && sz(second) < 2; i += 2) {
  64.     int x = rem[i], y = i + 1 < sz(rem) ? rem[i + 1] : b;
  65.     if (i + 2 >= sz(rem)) {
  66.     } else {
  67.       if (check(a, x, y)) continue;
  68.     }
  69.  
  70.     if (check(a, b, x)) {
  71.       second.pb(y);
  72.     } else
  73.       second.pb(x);
  74.   }
  75.   assert(sz(second) >= 2);
  76.   Answer(a + 1, b + 1, second[0] + 1, second[1] + 1);
  77.   assert(false);
  78. }
RAW Paste Data