Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2017/SEPT.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
| [SEPT17](https://www.codechef.com/SEPT17) | [MINPERM](https://www.codechef.com/SEPT17/problems/MINPERM) | ★★ | | | | [![image](../img/GH.png)](SEPT/SEPT17/MINPERM/MINPERM.py) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/15236776) (100 pts) [![image](../img/AC.png)](#) |
| [SEPT17](https://www.codechef.com/SEPT17) | [CHEFPDIG](https://www.codechef.com/SEPT17/problems/CHEFPDIG) | ★★★ | | | | |
| [SEPT17](https://www.codechef.com/SEPT17) | [SEACO](https://www.codechef.com/SEPT17/problems/SEACO) | ★★★★ | | [![image](../img/CC.png)](https://www.codechef.com/viewsolution/15338761) [![image](../img/GH.png)](SEPT/SEPT17/SEACO/SEACO.cpp) (100 pts) [![image](../img/AC.png)](#) | | |
| [SEPT17](https://www.codechef.com/SEPT17) | [FILLMTR](https://www.codechef.com/SEPT17/problems/FILLMTR) | ★★★★ | | [![image](../img/CC.png)](https://www.codechef.com/viewsolution/15243260) [![image](../img/GH.png)](SEPT/SEPT17/FILLMTR/FILLMTR.cpp) (100 pts) [![image](../img/AC.png)](#) | | |
| [SEPT17](https://www.codechef.com/SEPT17) | [FILLMTR](https://www.codechef.com/SEPT17/problems/FILLMTR) | ★★★★ | | [![image](../img/CC.png)](https://www.codechef.com/viewsolution/15243260) [![image](../img/GH.png)](SEPT/SEPT17/FILLMTR/FILLMTR.cpp) (100 pts) [![image](../img/AC.png)](#) | | [![image](../img/GH.png)](SEPT/SEPT17/FILLMTR/FILLMTR.py) [![image](../img/CC.png)](https://www.codechef.com/viewsolution/15258986) (100 pts) [![image](../img/AC.png)](#) |
| [SEPT17](https://www.codechef.com/SEPT17) | [WEASELTX](https://www.codechef.com/SEPT17/problems/WEASELTX) | ★★★★★ | | | | |
| [SEPT17](https://www.codechef.com/SEPT17) | [SEAFUNC](https://www.codechef.com/SEPT17/problems/SEAFUNC) | ★★★★★ | | | | |
| [SEPT17](https://www.codechef.com/SEPT17) | [SUMCUBE](https://www.codechef.com/SEPT17/problems/SUMCUBE) | ★★★★★★ | | | | |
Expand Down
67 changes: 67 additions & 0 deletions 2017/SEPT/SEPT17/FILLMTR/FILLMTR.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
def main():
t = int(raw_input())
while t:
t -= 1
n = map(int, raw_input().split())
q = n[1]
n = n[0]
queries = []
good = []
ans = 1
for i in range(n):
good.append('a')
good.append('a')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code does not comply to PEP8.

Origin: PEP8Bear, Section: pep8.

The issue can be fixed by applying the following patch:

--- a/tmp/tmplt5sx928/2017/SEPT/SEPT17/FILLMTR/FILLMTR.py
+++ b/tmp/tmplt5sx928/2017/SEPT/SEPT17/FILLMTR/FILLMTR.py
@@ -62,7 +62,7 @@
         else:
             print "no"
 
-            
+
 if __name__ == '__main__':
     main()
     

for i in range(q):
a = map(int, raw_input().split())
queries.append(a)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code does not comply to PEP8.

Origin: PEP8Bear, Section: pep8.

The issue can be fixed by applying the following patch:

--- a/tmp/tmplt5sx928/2017/SEPT/SEPT17/FILLMTR/FILLMTR.py
+++ b/tmp/tmplt5sx928/2017/SEPT/SEPT17/FILLMTR/FILLMTR.py
@@ -65,4 +65,3 @@
             
 if __name__ == '__main__':
     main()
-    

queries.sort()
for i in queries:
if(i[0] == i[1] and i[2] == 1):
ans = 0
break
elif(i[0] == i[1] and i[2] == 0):
continue
else:
if(good[i[0]] == 'a' and good[i[1]] == 'a'):
if(i[2] == 1):
good[i[0]] = 1
good[i[1]] = 0
else:
good[i[0]] = 0
good[i[1]] = 0
elif(good[i[0]] != 'a' and good[i[1]] == 'a'):
if(good[i[0]] == 1):
if(i[2] == 1):
good[i[1]] = 0
else:
good[i[1]] = 1
else:
if(i[2] == 1):
good[i[1]] = 1
else:
good[i[1]] = 0
elif(good[i[0]] == 'a' and good[i[1]] != 'a'):
if(good[i[1]] == 1):
if(i[2] == 1):
good[i[0]] = 0
else:
good[i[0]] = 1
else:
if(i[2] == 1):
good[i[0]] = 1
else:
good[i[0]] = 0
else:
if(abs(good[i[0]] - good[i[1]]) == i[2]):
continue
else:
ans = 0
break
if(ans):
print "yes"
else:
print "no"


if __name__ == '__main__':
main()