C

import java.util.Scanner;

public class T216910 {

    private static int[][] database = new int[1000][100];
    
    public static void main(String[] args) {
        int n, k;
        int currentRow = 0;
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        k = in.nextInt();

        int[][] database = new int[n][k+1];
        for (int i = 0; i < n; i++) {
            int opt = in.nextInt();
            if (opt == 1) {
                int p = in.nextInt();
                for (int j = 0; j < p; j++) {
                    int xi = in.nextInt();
                    int yi = in.nextInt();
                    database[currentRow][xi] = yi;
                }
                currentRow++;
            }
            if (opt == 2) {
                int sum = 0;
                int x = in.nextInt();
                int y_min = in.nextInt();
                int y_max = in.nextInt();
                for (int j = 0; j < currentRow; j++) {
                    if ((database[j][x] >= y_min) && (database[j][x] <= y_max)) {
                        sum++;
                    }
                }
                System.out.println(sum);
            }
        }
    }
}

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×