結果
| 問題 |
No.2110 012 Matching
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-28 21:27:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,194 bytes |
| コンパイル時間 | 260 ms |
| コンパイル使用メモリ | 82,388 KB |
| 実行使用メモリ | 83,204 KB |
| 最終ジャッジ日時 | 2024-07-06 00:28:25 |
| 合計ジャッジ時間 | 2,605 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 11 |
ソースコード
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
return ans
print('\n'.join(str(main()) for _ in range(int(input()))))