CF1895E.Infinite Card Game

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The first line contains a single integer tt ( 1t1041 \le t \le 10^4 ) — the number of test cases.

The first line of each test case contains an integer nn ( 1n31051 \le n \le 3 \cdot 10^5 ) — the number of cards Monocarp has.

The second line contains nn integers ax1,ax2,,axn\mathit{ax}_1, \mathit{ax}_2, \dots, \mathit{ax}_n ( 1axi1061 \le \mathit{ax}_i \le 10^6 ) — the attack values of Monocarp's cards.

The third line contains nn integers ay1,ay2,,ayn\mathit{ay}_1, \mathit{ay}_2, \dots, \mathit{ay}_n ( 1ayi1061 \le \mathit{ay}_i \le 10^6 ) — the defence values of Monocarp's cards.

The fourth line contains a single integer mm ( 1m31051 \le m \le 3 \cdot 10^5 ) — the number of cards Bicarp has.

The fifth line contains mm integers bx1,bx2,,bxm\mathit{bx}_1, \mathit{bx}_2, \dots, \mathit{bx}_m ( 1bxj1061 \le \mathit{bx}_j \le 10^6 ) — the attack values of Bicarp's cards.

The sixth line contains mm integers by1,by2,,bym\mathit{by}_1, \mathit{by}_2, \dots, \mathit{by}_m ( 1byj1061 \le \mathit{by}_j \le 10^6 ) — the defence values of Bicarp's cards.

Additional constraints on the input: the sum of nn over all test cases doesn't exceed 31053 \cdot 10^5 , the sum of mm over all test cases doesn't exceed 31053 \cdot 10^5 .

输入格式

For each test case, print three integers:

  • the number of Monocarp's starting moves that result in a win for Monocarp;
  • the number of Monocarp's starting moves that result in a draw;
  • the number of Monocarp's starting moves that result in a win for Bicarp.

输出格式

输入输出样例

  • 输入#1

    3
    3
    8 7 4
    7 1 10
    2
    8 4
    5 10
    9
    8 8 5 5 5 4 4 1 4
    2 7 5 2 8 9 7 1 9
    10
    9 8 7 6 5 5 4 3 2 1
    7 1 6 7 5 8 8 4 9 6
    1
    10
    5
    1
    10
    5

    输出#1

    1 1 1
    2 4 3
    0 1 0
首页