Advertisement
VisualPaul

StrangeSoluntion

Nov 26th, 2014
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, m, k;
  8.  
  9.     cin >> n >> k >> m;
  10.     vector<int> occupied(n - 1, 0);
  11.     for (int i = 0; i < m; ++i) {
  12.         int x, y;
  13.         cin >> x >> y;
  14.         for (int i = x; i < y; ++i) {
  15.             if (occupied[i] == k) {
  16.                 cout << "0\n";
  17.                 goto next_customer;
  18.             }
  19.         }
  20.         for (int i = x; i < y; ++i)
  21.             ++occupied[i];
  22.         cout << "1\n";
  23. next_customer:
  24.         continue;
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement