Advertisement
StoneHaos

COPP3()

Dec 16th, 2019
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. //Сборка контеста
  2.  
  3. // test.cpp: определяет точку входа для консольного приложения.
  4. //
  5.  
  6. #include "stdafx.h"
  7. #include <iostream>
  8. #include <algorithm>
  9. #include <vector>
  10. #include <math.h>
  11. #include <stdio.h>
  12. #include <set>
  13. #define nl "\n"
  14.  
  15. using namespace std;
  16.  
  17. int main(void) {
  18.     int n, m, a, del = 0;
  19.     scanf("%d%d", &n, &m);
  20.     vector<int> cnts(n, 0);
  21.     for (int i = 0; i < m; ++ i) {
  22.         scanf("%d", &a);
  23.         ++ cnts[a - 1];
  24.         bool flag = true;
  25.         for (int j = 0; j < n; ++ j) {
  26.             if (cnts[j] - del <= 0) {
  27.                 flag = false;
  28.                 break;
  29.             }
  30.         }
  31.         if (flag) {
  32.             ++ del;
  33.             printf("1");
  34.         }
  35.         else
  36.             printf("0");
  37.     }
  38.     printf("\n");
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement