結果

問題 No.2110 012 Matching
ユーザー titan23titan23
提出日時 2022-10-28 21:29:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 3,228 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 85,088 KB
最終ジャッジ日時 2023-09-20 04:13:32
合計ジャッジ時間 4,243 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
72,712 KB
testcase_01 AC 170 ms
80,556 KB
testcase_02 AC 189 ms
82,892 KB
testcase_03 AC 175 ms
81,536 KB
testcase_04 AC 201 ms
83,696 KB
testcase_05 AC 193 ms
82,212 KB
testcase_06 AC 185 ms
82,568 KB
testcase_07 AC 211 ms
85,088 KB
testcase_08 AC 148 ms
78,904 KB
testcase_09 AC 160 ms
79,676 KB
testcase_10 AC 211 ms
84,732 KB
testcase_11 AC 114 ms
72,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()
import math
from heapq import heapify, heappush, heappop
from bisect import bisect_right, bisect_left
from itertools import *
from collections import *
import random
inf = float('inf')
def error(*args, sep=' ', end='\n'):
  print(*args, sep=sep, end=end, file=sys.stderr)
def ltos(a, f=str, sep=' '):
  return sep.join(map(f, a))
# sys.setrecursionlimit(10**5)

"Use HashSet and HashDict only if elements are int."
class HashSet(set):

  def __init__(self, *args):
    self._xor1 = random.randrange(10**16, 10**18)
    self._xor2 = random.randrange(10**16, 10**18)
    self._xor3 = random.randrange(10**16, 10**18)
    self._rad  = random.randrange(10**3 , 10**18)
    if args:
      super().__init__(map(lambda x: self._hash(x), *args))

  def _hash(self, x):
    x = x ^ self._xor1 ^ self._xor2 ^ self._xor3
    x += self._rad
    return x
  
  def _rehash(self, x):
    x -= self._rad
    x = x ^ self._xor1 ^ self._xor2 ^ self._xor3
    return x
  
  def add(self, x):
    super().add(self._hash(x))

  def discard(self, x):
    super().discard(self._hash(x))

  def remove(self, x):
    super().remove(self._hash(x))

  def __contains__(self, item):
    return super().__contains__(self._hash(item))

  def __iter__(self):
    return (self._rehash(i) for i in super().__iter__())

  def __str__(self):
    return '{' + ', '.join(sorted([str(i) for i in self.__iter__()])) + '}'

"Do not use 'ele in HashDict.keys()'. Use 'ele in HashDict'."
class HashDict():
  
  def __init__(self, *args, func=int, c=False):
    self._xor1 = random.randrange(10**10, 10**18)
    self._xor2 = random.randrange(10**10, 10**18)
    self._xor3 = random.randrange(10**10, 10**18)
    self._rad = random.randrange(10**3 , 10**18)
    if c:
      if args:
        self._dat = Counter(map(lambda x: self._hash(x), *args))
      else:
        self._dat = Counter()
    else:
      self._dat = defaultdict(func)
    self._keys = HashSet()
    self._func = func

  def _hash(self, x):
    x = x ^ self._xor1 ^ self._xor2 ^ self._xor3
    x += self._rad
    return x

  def _rehash(self, x):
    x -= self._rad
    x = x ^ self._xor1 ^ self._xor2 ^ self._xor3
    return x
  
  def __setitem__(self, key, value):
    self._dat.__setitem__(self._hash(key), value)
    self._keys.add(self._hash(key))

  def __getitem__(self, item):
    return self._dat.__getitem__(self._hash(item))

  def __delitem__(self, item):
    self._dat.__delitem__(self._hash(item))
    self._keys.discard(self._hash(item))

  def __contains__(self, item):
    return (self._hash(item)) in self._keys

  def __len__(self):
    return len(self._dat)

  def keys(self):
    yield (self._rehash(i) for i in self._keys)

  def values(self):
    return self._dat.values()

  def items(self):
    return ((self._rehash(k), v) for k,v in self._dat.items())

  def __str__(self):
    li = [f'{k}: {v}' for k,v in self.items()]
    return '{' + ', '.join(li) + '}'


#  -----------------------  #

def main():
  a, b, c = map(int, input().split())
  ans = min(a, c)*2 + b//2*2
  if b % 2 == 1 and a-c > 0:
    ans += 1
  if c-a > 0:
    ans += (c-a)//2
  return ans


print('\n'.join(str(main()) for _ in range(int(input()))))
0