QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#78491#5521. Excellent XOR ProblemmikeacCompile Error//C++141.0kb2023-02-19 09:54:052023-02-19 09:54:06

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-19 09:54:06]
  • 评测
  • [2023-02-19 09:54:05]
  • 提交

answer

import collections
import math
from operator import xor
import random
import sys
from functools import *
from heapq import *

input = lambda: sys.stdin.readline().rstrip("\r\n")
ints = lambda: list(map(int, input().split()))

# MOD = 998244353
# MOD = 10 ** 9 + 7

def solve() -> None:
    n = int(input())
    arr = ints()

    s = reduce(xor, arr)
    
    if s:
        print("YES")
        print(2)
        print(1, 1)
        print(2, n)
    else:
        first = 0
        idx = -1
        xors = 0
        for i in range(n - 1):
            xors ^= arr[i]
            if xors != 0:
                if first == 0:
                    first = xors
                    idx = i + 1
                elif xors != first:
                    print("YES")
                    print(3)
                    print(1, idx)
                    print(idx + 1, i + 1)
                    print(i + 2, n)
                    return

        print("NO")

t = int(input())
for _ in range(t):
    solve()

详细

answer.code:12:3: error: invalid preprocessing directive #MOD
   12 | # MOD = 998244353
      |   ^~~
answer.code:13:3: error: invalid preprocessing directive #MOD
   13 | # MOD = 10 ** 9 + 7
      |   ^~~
answer.code:1:1: error: ‘import’ does not name a type
    1 | import collections
      | ^~~~~~
answer.code:1:1: note: C++20 ‘import’ only available with ‘-fmodules-ts’