Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class Main {
- public static void main(String[] args) {
- InputStream inputStream = System.in;
- OutputStream outputStream = System.out;
- InputReader in = new InputReader(inputStream);
- PrintWriter out = new PrintWriter(outputStream);
- Solver solver = new Solver();
- solver.solve(in, out);
- out.close();
- }
- static class Solver {
- public void solve(InputReader in, PrintWriter out) {
- int n = in.nextInt();
- int m = in.nextInt();
- int[] a = new int[m];
- for (int i = 0; i < m; ++i) {
- a[i] = in.nextInt();
- }
- boolean[] chosen = new boolean[n + 1];
- int tot = 0;
- for (int i = 0; i < m; ++i) {
- if (!chosen[a[i]]) {
- ++tot;
- chosen[a[i]] = true;
- }
- if (tot == n) {
- out.print("1");
- tot = 0;
- chosen = new boolean[n + 1];
- } else {
- out.print("0");
- }
- }
- }
- }
- static class InputReader {
- public BufferedReader reader;
- public StringTokenizer tokenizer;
- public InputReader(InputStream stream) {
- reader = new BufferedReader(new InputStreamReader(stream), 32768);
- tokenizer = null;
- }
- public String next() {
- while (tokenizer == null || !tokenizer.hasMoreElements()) {
- try {
- tokenizer = new StringTokenizer(reader.readLine());
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- return tokenizer.nextToken();
- }
- public String nextLine() {
- String s = "";
- try {
- s = reader.readLine();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- return s;
- }
- public int nextInt() {
- return Integer.parseInt(next());
- }
- public long nextLong() {
- return Long.parseLong(next());
- }
- public double nextDouble() {
- return Double.parseDouble(next());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement