D. Powerful Ksenia

from functools import reduce
n = int(input())
a = list(map(int, input().split()))
def solve(n):
    print("YES\n", n-1, sep = '')
    for i in range(n//2):
        print(2*i+1, 2*i+2, n)
    for i in range(n//2):
        print(2*i+1, 2*i+2, n)
if n%2 == 1:
    solve(n)
elif reduce(lambda x, y : x^y, a, 0) > 0:
    print("NO")
else:
    solve(n-1)
  • 動作を画像にすると以下

f:id:peroon:20201119232251p:plain