Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitafd2586

Browse files
author
sqdorte
committed
03/2 - python
1 parent3bfcc9a commitafd2586

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

‎2018/03_2/python/sqdorte.py‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
withopen('input','r')asraw:
2+
i=raw.read().strip().split('\n')
3+
4+
claimed= {}
5+
claims= []
6+
7+
forxini:
8+
claim=x.split('@ ')
9+
10+
cid=claim[0][1:]
11+
coords=claim[1].split(': ')
12+
13+
a,b=map(int,coords[0].split(','))
14+
c,d=map(int,coords[1].split('x'))
15+
16+
forxinrange(a,a+c):
17+
foryinrange(b,b+d):
18+
try:
19+
claimed[(x,y)]+=1
20+
exceptKeyError:
21+
claimed[(x,y)]=1
22+
23+
claims.append((cid,a,b,c,d))
24+
25+
forcid,a,b,c,dinclaims:
26+
s=True
27+
forxinrange(a,a+c):
28+
ifnots:
29+
break
30+
foryinrange(b,b+d):
31+
ifclaimed[(x,y)]>1:
32+
s=False
33+
break
34+
ifs:
35+
print(cid)
36+
break

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp