s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s031098915 | p03579 | u219015402 | 1587088380 | Python | Python (3.4.3) | py | Runtime Error | 584 | 31460 | 718 |
N,M = map(int,input().split())
graph = {i:[] for i in range(N)}
for _ in range(M):
x,y = map(int,input().split())
x -= 1
y -= 1
graph[x].append(y)
graph[y].append(x)
color = [0 for _ in range(N)]
def f(u,c):
color[u] = c
for v in graph[u]:
if color[v] == c: # 隣接している頂点が同色の場合 二部グラフで... |
s498363271 | p03579 | u219015402 | 1587088183 | Python | Python (3.4.3) | py | Runtime Error | 564 | 31468 | 718 |
N,M = map(int,input().split())
graph = {i:[] for i in range(N)}
for _ in range(M):
x,y = map(int,input().split())
x -= 1
y -= 1
graph[x].append(y)
graph[y].append(x)
color = [0 for _ in range(N)]
def f(u,c):
color[u] = c
for v in graph[u]:
if color[v] == c: # 隣接している頂点が同色の場合 二部グラフで... |
s120736850 | p03579 | u219015402 | 1587088029 | Python | Python (3.4.3) | py | Runtime Error | 489 | 30564 | 725 |
N,M = map(int,input().split())
graph = {i:[] for i in range(N)}
for _ in range(M):
x,y = map(int,input().split())
x -= 1
y -= 1
graph[x].append(y)
graph[y].append(x)
color = [0 for _ in range(N)]
def f(u,c):
color[u] = c
for v in graph[u]:
if color[v] == c: # 隣接している頂点が同色の場合 二部グラフで... |
s441852221 | p03579 | u219015402 | 1587087651 | Python | Python (3.4.3) | py | Runtime Error | 614 | 31792 | 762 |
N,M = map(int,input().split())
graph = {i:[] for i in range(N)}
for _ in range(M):
x,y = map(int,input().split())
x -= 1
y -= 1
graph[x].append(y)
graph[y].append(x)
color = [0 for _ in range(N)]
def f(v,c):
color[v] = c
for j in range(len(graph[v])):
if color[ graph[v][j] ] == c:... |
s998883164 | p03579 | u219015402 | 1587086723 | Python | Python (3.4.3) | py | Runtime Error | 647 | 31452 | 688 |
N,M = map(int,input().split())
graph = {i:[] for i in range(N)}
for _ in range(M):
x,y = map(int,input().split())
x -= 1
y -= 1
graph[x].append(y)
graph[y].append(x)
color = [0 for _ in range(N)]
def f(v,c):
color[v] = c
for i in range(len(graph[v])):
if color[ graph[v][i] ] ==c:
... |
s293391500 | p03579 | u219015402 | 1587086439 | Python | Python (3.4.3) | py | Runtime Error | 618 | 31972 | 661 |
N,M = map(int,input().split())
graph = {i:[] for i in range(N)}
for _ in range(M):
x,y = map(int,input().split())
x -= 1
y -= 1
graph[x].append(y)
graph[y].append(x)
color = [0 for _ in range(N)]
def f(v,c):
color[v] = c
for i in range(len(graph[v])):
if color[ graph[v][i] ] ==c:
... |
s745037584 | p03579 | u476604182 | 1586457520 | Python | Python (3.4.3) | py | Runtime Error | 271 | 25336 | 480 | N, M, *L = map(int, open(0).read().split())
dic = [[] for i in range(N+1)]
for a,b in zip(*[iter(L)]*2):
dic[a].append(b)
dic[b].append(a)
color = [0]*(N+1)
def dfs(v,c):
color[v] = c
for u in dic[v]:
if color[u]==c:
return False
if color[u]==0 and not dfs(u,-c):
return False
return True
f... |
s004638279 | p03579 | u571969099 | 1584984578 | Python | PyPy3 (2.4.0) | py | Runtime Error | 854 | 106784 | 483 | n, m = [int(i) for i in input().split()]
e = [[] for _ in range(n)]
for _ in range(m):
a, b = [int(i) - 1 for i in input().split()]
e[a].append(b)
e[b].append(a)
ok = False
tag = [-1] * n
def dfs(i=0, c=0):
global ok, tag
if tag[i] != -1:
if tag[i] != c:
ok = True
retu... |
s833480120 | p03579 | u649326276 | 1584898126 | Python | Python (3.4.3) | py | Runtime Error | 547 | 32176 | 588 | import sys
sys.setrecursionlimit(10000)
def dfs(G, v, cur):
color[v] = cur;
for next_v in G[v] :
if not(color[next_v] == -1) :
if color[next_v] == cur :
return 0;
continue;
if not(dfs(G,next_v,1-cur)):
return 0;
return 1;
n,m = list(map... |
s113087178 | p03579 | u649326276 | 1584898072 | Python | Python (3.4.3) | py | Runtime Error | 529 | 30092 | 587 | import sys
sys.setrecursionlimit(5000)
def dfs(G, v, cur):
color[v] = cur;
for next_v in G[v] :
if not(color[next_v] == -1) :
if color[next_v] == cur :
return 0;
continue;
if not(dfs(G,next_v,1-cur)):
return 0;
return 1;
n,m = list(map(... |
s406021452 | p03579 | u649326276 | 1584898010 | Python | Python (3.4.3) | py | Runtime Error | 498 | 28324 | 587 | import sys
sys.setrecursionlimit(3000)
def dfs(G, v, cur):
color[v] = cur;
for next_v in G[v] :
if not(color[next_v] == -1) :
if color[next_v] == cur :
return 0;
continue;
if not(dfs(G,next_v,1-cur)):
return 0;
return 1;
n,m = list(map(... |
s177304399 | p03579 | u281610856 | 1584371421 | Python | Python (3.4.3) | py | Runtime Error | 587 | 22952 | 1123 | # 二部グラフ判定
def dfs(u, c):
color[u] = c # 訪問したら指定の色で塗る
for v in G[u]: # uからつながっている頂点を順に取り出す
if color[v] != -1: # すでに訪問していた場合
if color[v] == c:
return False # 隣接する頂点が同じ色のときはFalse
else:
continue
else: # 未訪問の時は色は違う色にしてDFSで再帰的に探索
... |
s665197619 | p03579 | u844646164 | 1584321501 | Python | Python (3.4.3) | py | Runtime Error | 700 | 31944 | 474 |
import numpy as np
n, m = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(m):
u, v = map(lambda x: int(x)-1, input().split())
g[u] += [v]
g[v] += [u]
col = [0]*n
def dfs(u, c):
col[u] = c
for v in g[u]:
if col[v] == c:
return False
if (col[v] == 0 and not dfs(v, -c)):
... |
s097743392 | p03579 | u649326276 | 1584053600 | Python | Python (3.4.3) | py | Runtime Error | 513 | 26520 | 546 | def dfs(G, v, cur):
color[v] = cur;
for next_v in G[v] :
if not(color[next_v] == -1) :
if color[next_v] == cur :
return 0;
continue;
if not(dfs(G,next_v,1-cur)):
return 0;
return 1;
n,m = list(map(int,input().split()));
G = [[] for i in ... |
s589731231 | p03579 | u893063840 | 1581860234 | Python | Python (3.4.3) | py | Runtime Error | 730 | 63712 | 1221 | import sys
sys.setrecursionlimit(10 ** 6)
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
g = [[] for _ in range(n)]
for a, b in ab:
a -= 1
b -= 1
g[a].append(b)
g[b].append(a)
class Tree:
WHITE = 0
GRAY = 1
BLACK = 2
def __init__(self, adj)... |
s282233605 | p03579 | u450956662 | 1581179813 | Python | Python (3.4.3) | py | Runtime Error | 2193 | 715056 | 553 | import sys
sys.setrecursionlimit(10 ** 6)
def is_bipartite(v, r, d):
color[v] = d
for u in E[v]:
if u == r:
continue
if color[u] == d:
return False
is_bipartite(u, v, (d + 1) % 2)
return True
N, M = map(int, input().split())
E = [[] for _ in range(N)]
color ... |
s379205606 | p03579 | u955125992 | 1580644739 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 803 | from collections import deque
def dfs():
global color
global edge
color = [-1] * n
edge = [[] for _ in range(n)]
q = deque([])
q.append(0)
color[0] = 1
while q:
p = q.pop()
for u in edge[p]:
if color[u] == -1:
color[u] = (color[p] + 1) %... |
s716512114 | p03579 | u334712262 | 1580361152 | Python | PyPy3 (2.4.0) | py | Runtime Error | 553 | 117336 | 1769 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... |
s379356223 | p03579 | u724687935 | 1577602475 | Python | Python (3.4.3) | py | Runtime Error | 495 | 23296 | 657 | from collections import Counter
def dfs(x):
res = True
for e in edge[x]:
if color[e] is None:
color[e] = 0 if color[x] else 1
res &= dfs(e)
else:
if color[e] == color[x]:
res &= False
else:
res &= True
return r... |
s646173663 | p03579 | u532966492 | 1576359540 | Python | Python (3.4.3) | py | Runtime Error | 585 | 44224 | 647 | def main():
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for _ in [0]*m]
g=[[] for _ in [0]*n]
[g[a-1].append(b-1) for a,b in ab]
[g[b-1].append(a-1) for a,b in ab]
ans=[None]*n
ans[0]=0
temp=[0]
while temp:
i=temp.pop()
for j in g[i]:
i... |
s036269551 | p03579 | u550943777 | 1576292744 | Python | Python (3.4.3) | py | Runtime Error | 564 | 23040 | 856 | class BinPartite:
def __init__(self, N, es):
self.colors = [0 for i in range(N)]
self.es = es
def dfs(self, v, color):
self.colors[v] = color
for to in self.es[v]:
if self.colors[to] == color:
return False
if self.colors[to] == 0 and not s... |
s548135516 | p03579 | u375870553 | 1574908722 | Python | Python (3.4.3) | py | Runtime Error | 623 | 35672 | 894 | from collections import defaultdict
G = defaultdict(list)
N, M = map(int, input().split())
visited = [[False for i in range(N)] for j in range(5)]
for i in range(M):
v,u = map(int, input().split())
G[v-1].append(u-1)
G[u-1].append(v-1)
# 頂点間に奇数長のパスがあるかどうか確認するために 2部グラフ 判定をする
COLOR = [0 for i in range(N)]... |
s671810958 | p03579 | u278356323 | 1574359071 | Python | Python (3.4.3) | py | Runtime Error | 511 | 22988 | 558 | import math
n, m = map(int, input().split())
color = [-1]*n
edge = [list() for _ in range(n)]
for _ in range(m):
a, b = map(int, input().split())
edge[a-1].append(b-1)
edge[b-1].append(a-1)
flag = True
def dfs(i, pre, c):
if color[i] == c:
return
elif color[i] == 1-c:
global flag... |
s279813005 | p03579 | u898967808 | 1572711272 | Python | Python (3.4.3) | py | Runtime Error | 2107 | 43164 | 663 | vn,en = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(en)]
e = [[] for _ in range(vn)]
for f,t in ab:
e[f-1].append(t-1)
e[t-1].append(f-1)
def dfs(v, root:list):
if v in root:
return
else:
root.append(v)
if len(root)==4:
if not (root[-1] in e[root[0]])... |
s853039069 | p03579 | u392029857 | 1571859647 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 927 | import sys
sys.setrecursionlimit(4100000)
def main():
def Dfs(G, s, v, cnt = 0):
if cnt == 3:
if v != s and not (v in G[s]):
seen[v] = 1
return
for next_v in G[v]:
Dfs(G, s, next_v, cnt+1)
input = sys.stdin.readline
n, m = map(int, input()... |
s317191491 | p03579 | u310678820 | 1570901696 | Python | Python (3.4.3) | py | Runtime Error | 477 | 22064 | 648 | N, M = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
G[a-1].append(b-1)
G[b-1].append(a-1)
def is_bipartite(G):
n = len(G)
color = [-1]*n
que = deque([0])
color[0] = 0
while que:
v = que.pop()
c = color[v]
... |
s672993936 | p03579 | u600402037 | 1570421230 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 800 | import sys
sys.setrecursionlimit(10 ** 7)
N, M = map(int,input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
graph = [[] for _ in range(N)]
for a,b in AB:
graph[a−1].append(b-1)
graph[b-1].append(a-1)
# 二部グラフかどうかの判定
color = [None] * N
color[0] = 0
q = [0]
while q:
x = q.pop()
f... |
s796866589 | p03579 | u482808969 | 1569814047 | Python | PyPy3 (2.4.0) | py | Runtime Error | 820 | 85152 | 616 | n, m = map(int, input().split())
g = [[] for _ in range(n)]
for i in range(m):
a, b = map(int, input().split())
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
color = [-1] * n
black = 0
white = 0
def dfs(v, c):
global black, white
color[v] = c
if c == 0:
black += 1
else:
... |
s623827478 | p03579 | u482808969 | 1569813644 | Python | PyPy3 (2.4.0) | py | Runtime Error | 667 | 57324 | 586 | n, m = map(int, input().split())
g = [[] for _ in range(n)]
for i in range(m):
a, b = map(int, input().split())
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
color = [-1] * n
black = 0
white = 0
def dfs(v, c):
global black, white
color[v] = c
if c == 0:
black += 1
else:
... |
s806158657 | p03579 | u052499405 | 1562597788 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 891 | #include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
using namespace std;
using ll = long long int;
int MAX_N = 1e5;
vector<int> is_odd(MAX_N, -1);
vector<vector<int>> edge(MAX_N, vector<int>{});
ll odd_num = 0;
ll even_num = 0;
ll n, m;
int dfs(int d, int v){
if(is_odd[v] !... |
s436654706 | p03579 | u057109575 | 1561847385 | Python | PyPy3 (2.4.0) | py | Runtime Error | 815 | 99672 | 572 | N, M = map(int, input().split())
edges = [list(map(int, input().split())) for _ in range(M)]
graph = [[] for _ in range(N)]
for x, y in edges:
graph[x - 1].append(y - 1)
graph[y - 1].append(x - 1)
def dfs(v, c):
# c: color = 1 or -1
node[v] = c
for i in graph[v]:
if node[i] == c:
... |
s946284179 | p03579 | u379692329 | 1561482381 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 898 | import sys
sys.setrecursionlimit(10**6)
from operator import mul
from functools import reduce
def comb(n,r):
r = min(n-r,r)
if r == 0: return 1
over = reduce(mul, range(n, n - r, -1))
under = reduce(mul, range(1,r + 1))
return over // under
def dfs(v, cur):
color[v] = cur
for next_v ... |
s572780937 | p03579 | u619819312 | 1559519374 | Python | Python (3.4.3) | py | Runtime Error | 452 | 31140 | 461 | import sys
sys.setrecursionlimit(10**6)
n,m=map(int,input().split())
s=[[]for i in range(n+1)]
c=[0]*(n+1)
for i in range(m):
a,b=map(int,input().split())
s[a].append(b)
s[b].append(a)
def dfs(v,t):
c[v]=t
for i in s[v]:
if c[i]==t:
return false
if c[i]==0 and not dfs(i,-... |
s734422153 | p03579 | u414425367 | 1558659893 | Python | PyPy3 (2.4.0) | py | Runtime Error | 840 | 131672 | 587 | N,M=[int(a) for a in input().split()]
AB=[[int(a) for a in input().split()] for _ in range(M)]
edges = [[] for _ in range(N)]
for a, b in AB:
edges[a-1].append(b-1)
edges[b-1].append(a-1)
visited = [False]*N
WH = [None]*N
def dfs(curr, is_white):
if visited[curr]:
return WH[curr]^is_white
WH[c... |
s554213413 | p03579 | u798129018 | 1558381011 | Python | PyPy3 (2.4.0) | py | Runtime Error | 175 | 38256 | 905 | #s,t間に奇数長のパスが存在したならば必ずs,t間には辺が張られる
#グラフが二部グラフでないならば奇数長のサイクルが存在して任意の(s,t)間に奇数長パスが作れる
#グラフが二部グラフであるならば異なるカラーグループ間の頂点には必ず辺が張られる
n,m = map(int,input().split())
G = defaultdict(set)
color = [0 for i in range(n)]
for i in range(m):
a, b = map(int, input().split())
G[a-1].add(b-1)
G[b-1].add(a-1)
#二部グラフ判定
color[0]... |
s991009401 | p03579 | u238510421 | 1558236696 | Python | PyPy3 (2.4.0) | py | Runtime Error | 681 | 64928 | 760 | from collections import Counter
import sys
sys.setrecursionlimit(1000000)
N,M = map(int, input().split())
# 隣接リスト
l = [[] for i in range(N+1)]
for i in range(M):
ab = list(map(int, input().split()))
a = min(ab)
b = max(ab)
l[a].append(b)
nodes_color = {node:0 for node in range(1, N+1)}#set([a for ab... |
s346983637 | p03579 | u238510421 | 1558235894 | Python | PyPy3 (2.4.0) | py | Runtime Error | 874 | 108316 | 700 | from collections import Counter
N,M = map(int, input().split())
# 隣接リスト
l = [[] for i in range(N+1)]
for i in range(M):
a,b = map(int, input().split())
l[a].append(b)
l[b].append(a)
nodes_color = {node:0 for node in range(1, N+1)}#set([a for ab in ab_list for a in ab])}
def func(v,c):
if nodes_colo... |
s295802517 | p03579 | u238510421 | 1558235807 | Python | PyPy3 (2.4.0) | py | Runtime Error | 176 | 38640 | 700 | from collections import Counter
N,M = map(int, input().split())
# 隣接リスト
l = [[] for i in range(n+1)]
for i in range(m):
a,b = map(int, input().split())
l[a].append(b)
l[b].append(a)
nodes_color = {node:0 for node in range(1, N+1)}#set([a for ab in ab_list for a in ab])}
def func(v,c):
if nodes_colo... |
s895839958 | p03579 | u238510421 | 1558235757 | Python | PyPy3 (2.4.0) | py | Runtime Error | 171 | 38384 | 667 | N,M = map(int, input().split())
# 隣接リスト
l = [[] for i in range(n+1)]
for i in range(m):
a,b = map(int, input().split())
l[a].append(b)
l[b].append(a)
nodes_color = {node:0 for node in range(1, N+1)}#set([a for ab in ab_list for a in ab])}
def func(v,c):
if nodes_color[v] == c:
return True
... |
s933506592 | p03579 | u238510421 | 1558235669 | Python | PyPy3 (2.4.0) | py | Runtime Error | 177 | 38384 | 667 | N,M = map(int, input().split())
# 隣接リスト
l = [[] for i in range(n+1)]
for i in range(m):
a,b = map(int, input().split())
l[a].append(b)
l[b].append(a)
nodes_color = {node:0 for node in range(1, N+1)}#set([a for ab in ab_list for a in ab])}
def func(v,c):
if nodes_color[v] == c:
return True
... |
s190818857 | p03579 | u238510421 | 1558152268 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2109 | 113624 | 964 | from collections import Counter
N, M = map(int, input().split())
ab_list = []
for _ in range(M):
a, b = map(int, input().split())
ab_list.append([a,b])
nodes_color = {node:0 for node in range(1, N+1)}#set([a for ab in ab_list for a in ab])}
def func(v,c):
if nodes_color[v] == 0:
nodes_color[v]... |
s653650543 | p03579 | u236127431 | 1555948405 | Python | PyPy3 (2.4.0) | py | Runtime Error | 760 | 89504 | 417 | N,M=map(int,input().split())
G=[[] for i in range(N)]
for i in range(M):
a,b=map(int,input().split())
a-=1
b-=1
G[a].append(b)
G[b].append(a)
color=[-1]*N
def dfs(x):
for i in G[x]:
if color[i]==-1:
color[i]=1^color[x]
dfs(i)
elif color[i]==color[x]:
print((N*(N-1))//2-M)
e... |
s297008908 | p03579 | u298297089 | 1555940942 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 642 | v
N,M = map(int, input().split())
es = [[] for i in range(N)]
for i in range(M):
a,b = map(int, input().split())
a,b = a-1,b-1
es[a].append(b)
es[b].append(a)
colors = [0 for i in range(N)]
def is_bipartite():
stack = [(0,1)]
while stack:
v,color = stack.pop()
colors[v... |
s965171873 | p03579 | u608088992 | 1554244531 | Python | Python (3.4.3) | py | Runtime Error | 319 | 22948 | 572 | import sys
F = sys.stdin
N, M = map(int, F.readline().strip("\n").split())
Edge = [[] for _ in range(N)]
for _ in range(M):
A, B = map(int, F.readline().strip("\n").split())
Edge[A-1].append(B-1)
Edge[B-1].append(A-1)
Color = [0] * N
def dfs(v, c):
Color[v] = c
for next in Edge[v]:
if Col... |
s113196268 | p03579 | u884982181 | 1549140111 | Python | PyPy3 (2.4.0) | py | Runtime Error | 543 | 115104 | 707 | import sys
#sys.setrecursionlimit(200000)
input = sys.stdin.readline
n,m= map(int,input().split())
g = [[]for i in range(n)]
for i in range(m):
a,b = map(int,input().split())
a-=1;b-=1
g[a].append(b)
g[b].append(a)
kyo = [1<<50]*n
def dfs(x,y,z):
for i in g[x]:
if... |
s962982524 | p03579 | u785989355 | 1537663115 | Python | Python (2.7.6) | py | Runtime Error | 423 | 24956 | 852 | N,M = map(int,raw_input().split())
path = []
path_from=[[] for i in range(N)]
for i in range(M):
A,B = map(int,raw_input().split())
path_from[A-1].append(B-1)
path_from[B-1].append(A-1)
color_list = [0 for i in range(N)]
color_list[0] = 1
def two_part_or_not(start,path_from,color_list):
for end ... |
s446138315 | p03579 | u467736898 | 1537554850 | Python | Python (3.4.3) | py | Runtime Error | 573 | 31408 | 375 | N, M = map(int, input().split())
E = [sorted(list(map(int, input().split()))) for i in range(M)]
E.sort()
print(E)
L = [-1]*(N+1)
L[1] = 0
al = False
for e in E:
a, b = e
if L[b] == -1:
L[b] = 1-L[a]
elif L[a] + L[b] != 1:
al = True
break
if al:
print(N*(N-1)//2-M)
else:
c = ... |
s602709299 | p03579 | u631277801 | 1537442666 | Python | PyPy3 (2.4.0) | py | Runtime Error | 174 | 38640 | 1641 | #import sys
#stdin = sys.stdin
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
d... |
s009561554 | p03579 | u820560680 | 1534717952 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 628 | import sys
sys.getrecursionlimit(1000000)
N, M = map(int, input().split())
G = [[] for i in range(N)]
for _ in range(M):
Ai, Bi = map(int, input().split())
G[Ai - 1].append(Bi - 1)
G[Bi - 1].append(Ai - 1)
color = [0] * N
def dfs(v, c):
'''
頂点vをcで塗る そこから深さ優先探索で交互に塗っていく
'''
color[v] = c
... |
s961229631 | p03579 | u820560680 | 1534717449 | Python | Python (3.4.3) | py | Runtime Error | 465 | 22956 | 585 | N, M = map(int, input().split())
G = [[] for i in range(N)]
for _ in range(M):
Ai, Bi = map(int, input().split())
G[Ai - 1].append(Bi - 1)
G[Bi - 1].append(Ai - 1)
color = [0] * N
def dfs(v, c):
'''
頂点vをcで塗る そこから深さ優先探索で交互に塗っていく
'''
color[v] = c
for i in G[v]:
if color[i] == c:
... |
s115779469 | p03579 | u333945892 | 1530290666 | Python | Python (3.4.3) | py | Runtime Error | 648 | 41616 | 915 | from collections import defaultdict
N,M = map(int,input().split())
dict = defaultdict(set)
for i in range(M):
a,b = list(map(int,input().split()))
dict[a].add(b)
dict[b].add(a)
color = [0 for i in range(N+1)]
nibu = True
def dfs(v,c):
u'''
v : 現在のグラフの頂点
c : vのグラフのcolor
queue : 探索済みのグラフの頂点
res : 二部グラフの判定... |
s964529154 | p03579 | u297574184 | 1529538437 | Python | Python (3.4.3) | py | Runtime Error | 461 | 22940 | 937 | N, M = map(int, input().split())
adjL = [[] for v in range(N)]
for e in range(M):
A, B = map(int, input().split())
adjL[A - 1].append(B - 1)
adjL[B - 1].append(A - 1)
# 二部グラフかどうかを判定する(頂点を1or-1で塗っていく)
colors = [0] * N
def dfs(vNow, color):
colors[vNow] = color # 頂点vNowをcolorで塗る
for v in adjL[vNow]:... |
s099351170 | p03579 | u270681687 | 1527439495 | Python | Python (3.4.3) | py | Runtime Error | 517 | 23832 | 809 | n, m = map(int, input().split())
graph = [[] for i in range(n)]
for i in range(m):
a, b = map(int, input().split())
graph[a-1].append(b-1)
graph[b - 1].append(a - 1)
memo = [0 for i in range(n)]
color = [-1 for i in range(n)]
black = 0
white = 0
flag = 0
def search(v):
for i in graph[v]:
if... |
s765381736 | p03579 | u270681687 | 1527438124 | Python | Python (3.4.3) | py | Runtime Error | 2133 | 486064 | 881 | n, m = map(int, input().split())
graph = [[0 for i in range(n)] for j in range(n)]
for i in range(m):
a, b = map(int, input().split())
graph[a][b] = 1
graph[b][a] = 1
memo = [0 for i in range(n)]
color = [-1 for i in range(n)]
black = 0
white = 0
flag = 0
def search(v):
for i in range(n):
i... |
s187663503 | p03579 | u694433776 | 1525818696 | Python | Python (3.4.3) | py | Runtime Error | 532 | 23796 | 720 | n, m = map(int, input().split())
edge = [[] for i in range(n)]
for i in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
edge[a].append(b)
edge[b].append(a)
# -1 → 0,1に塗っていきます
color=[-1 for i in range(n)]
def dfs(pos):
ret = True
for i in range(len(edge[pos])):
to = edge[pos]... |
s760672981 | p03579 | u694433776 | 1525818485 | Python | Python (3.4.3) | py | Runtime Error | 556 | 23052 | 731 | n, m = map(int, input().split())
edge = [[] for i in range(n)]
for i in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
edge[a].append(b)
edge[b].append(a)
# -1 → 0,1に塗っていきます
color=[-1 for i in range(n)]
def dfs(pos):
ret = True
for i in range(len(edge[pos])):
to = edge[pos]... |
s763401047 | p03579 | u621935300 | 1509324071 | Python | Python (2.7.6) | py | Runtime Error | 461 | 24940 | 633 | # -*- coding: utf-8 -*-
import sys
N,M=list(map(int,raw_input().split()))
nl=[[] for i in range(N+1)]
for i in range(M):
x,y=map(int,raw_input().split())
nl[x].append(y)
nl[y].append(x)
#print nl
def dfs(v):
F[v]=1
for i in nl[v]:
if color[v]=="w" and color[i]==0:
color[i]="b"
elif color[v]=="b" and col... |
s163127805 | p03579 | u621935300 | 1509323981 | Python | Python (2.7.6) | py | Runtime Error | 444 | 24940 | 613 | # -*- coding: utf-8 -*-
import sys
N,M=list(map(int,raw_input().split()))
nl=[[] for i in range(N+1)]
for i in range(M):
x,y=map(int,raw_input().split())
nl[x].append(y)
nl[y].append(x)
#print nl
def dfs(v):
F[v]=1
for i in nl[v]:
if color[v]=="w" and color[i]==0:
color[i]="b"
elif color[v]=="b" and col... |
s075270363 | p03579 | u621935300 | 1509323638 | Python | Python (2.7.6) | py | Runtime Error | 466 | 24936 | 693 | # -*- coding: utf-8 -*-
import sys
N,M=list(map(int,raw_input().split()))
nl=[[] for i in range(N+1)]
for i in range(M):
x,y=map(int,raw_input().split())
nl[x].append(y)
nl[y].append(x)
#print nl
def dfs(v,p):
F[v]=1
for i in nl[v]:
if color[v]=="w" and color[i]==0:
color[i]="b"
elif color[v]=="b" and c... |
s129912112 | p03579 | u621935300 | 1509322735 | Python | Python (2.7.6) | py | Runtime Error | 412 | 24936 | 720 | # -*- coding: utf-8 -*-
import sys
N,M=list(map(int,raw_input().split()))
nl=[[] for i in range(N+1)]
for i in range(M):
x,y=map(int,raw_input().split())
nl[x].append(y)
nl[y].append(x)
#print nl
def dfs(v,p):
F[v]=1
global bip_graph
for i in nl[v]:
if color[v]=="w" and color[i]==0:
color[i]="b"
elif c... |
s783195023 | p03579 | u621935300 | 1509322136 | Python | Python (2.7.6) | py | Runtime Error | 464 | 24940 | 815 | # -*- coding: utf-8 -*-
N,M=list(map(int,raw_input().split()))
nl=[[] for i in range(N+1)]
for i in range(M):
x,y=map(int,raw_input().split())
nl[x].append(y)
nl[y].append(x)
#print nl
def dfs(v,p):
F[v]=1
global bip_graph
for i in nl[v]:
if color[v]=="w" and color[i]==0:
color[i]="b"
elif color[v]=="... |
s703516207 | p03579 | u621935300 | 1508715019 | Python | Python (2.7.6) | py | Runtime Error | 442 | 24940 | 799 | # -*- coding: utf-8 -*-
N,M=list(map(int,raw_input().split()))
nl=[[] for i in range(N+1)]
for i in range(M):
x,y=map(int,raw_input().split())
nl[x].append(y)
nl[y].append(x)
#print nl
def dfs(v,p):
F[v]=1
global bip_graph
for i in nl[v]:
#print v,i,color
if color[v]=="w" and color[i]==0:
color[i]="b"
... |
s733268869 | p03579 | u694433776 | 1508626778 | Python | PyPy3 (2.4.0) | py | Runtime Error | 890 | 119200 | 561 | n,m=map(int,input().split())
edge=[[] for i in range(n)]
for i in range(m):
a,b=map(int,input().split())
a-=1
b-=1
edge[a].append(b)
edge[b].append(a)
depth=[-1 for i in range(n)]
def check(i,h):
depth[i]=h
for j in edge[i]:
if depth[j]==-1:
check(j,(h+1)%2)
elif ... |
s733968281 | p03579 | u694433776 | 1508601756 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1000 | 119200 | 705 | n,m=map(int,input().split())
edge=[[] for i in range(n)]
for i in range(m):
a,b=map(int,input().split())
a-=1
b-=1
edge[a].append(b)
edge[b].append(a)
depth=[-1 for i in range(n)]
def check(i,h):
depth[i]=h
for j in edge[i]:
if depth[j]==-1:
check(j,h+1)
elif dept... |
s234763027 | p03579 | u694433776 | 1508601700 | Python | PyPy3 (2.4.0) | py | Runtime Error | 895 | 119200 | 705 | n,m=map(int,input().split())
edge=[[] for i in range(n)]
for i in range(m):
a,b=map(int,input().split())
a-=1
b-=1
edge[a].append(b)
edge[b].append(a)
depth=[-1 for i in range(n)]
def check(i,h):
depth[i]=h
for j in edge[i]:
if depth[j]==-1:
check(j,h+1)
elif dept... |
s993297553 | p03579 | u796424048 | 1507897876 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 41840 | 1222 | from collections import Counter
from collections import defaultdict
N,M = map(int,input().split())
dict = defaultdict(set)
for i in range(M):
a,b = list(map(int,input().split()))
dict[a].add(b)
dict[b].add(a)
color = [0 for i in range(N+1)]
res = True
def dfs(v,c,queue=[]):
u'''
v : 現在... |
s375930366 | p03579 | u466826467 | 1507776948 | Python | Python (3.4.3) | py | Runtime Error | 645 | 23376 | 868 | from collections import deque
def dfs(v, c):
flgs[v] = c
for i in range(len(G[v])):
if flgs[G[v][i]] == c:
return False
if flgs[G[v][i]] == 0 and not dfs(G[v][i], -c):
return False
return True
if __name__ == '__main__':
N, M = map(int, input().split())
G ... |
s939708863 | p03579 | u761320129 | 1507656003 | Python | Python (2.7.6) | py | Runtime Error | 477 | 24956 | 547 | N,M = map(int,raw_input().split())
es = [[] for i in range(N)]
for i in range(M):
a,b = map(int,raw_input().split())
a,b = a-1,b-1
es[a].append(b)
es[b].append(a)
colors = [0 for i in range(N)]
def dfs(v,color):
colors[v] = color
for to in es[v]:
if colors[to] == color:
return False
if color... |
s214270212 | p03579 | u509661905 | 1507566219 | Python | Python (3.4.3) | py | Runtime Error | 560 | 42920 | 1900 | #!/usr/bin/env python3
import sys
# 再帰深度の制限
REC_LIMIT = 10000
# 頂点の色
UNDEF = 0
WHITE = 1
BLACK = -WHITE
# 所与のグラフが二部グラフならば,(True, color[])を返す
# さもなければ,(False, None)を返す
# 参考:『プログラミングコンテストチャレンジブック』(第2版)p.94
def is_bipartite_graph(adj_list):
n = len(adj_list) # 頂点数
color = [UNDEF] * n
# 頂点をWHITEとBLACKで塗... |
s562768301 | p03579 | u257374434 | 1507516868 | Python | Python (3.4.3) | py | Runtime Error | 610 | 44856 | 1363 | from collections import deque,defaultdict
N ,M =list(map(int,input().split()))
AB =[ [int(x)-1 for x in input().split()] for _ in range(M)]
d =defaultdict(list)
for a,b in AB:
d[a].append(b)
d[b].append(a)
def check(i):
dists = [-1 for _ in range(N)]
dists[i]=0
#q = deque([ (1,val)for val in ... |
s838721917 | p03579 | u667084803 | 1507516819 | Python | PyPy3 (2.4.0) | py | Runtime Error | 648 | 57248 | 287 | N,M=map(int,input().split())
edges=[[] for i in range(N)]
for i in range(M):
a,b = map(int,input().split())
edges[a-1]+=[b-1]
edges[b-1]+=[a-1]
#print(edges)
ans=0
if N>7:
print((N*(N-1))//2-M)#奇数要素の閉路があった場合は全ての頂点を結べる.
else:
a=0/0 |
s696304662 | p03579 | u054957956 | 1507515592 | Python | Python (3.4.3) | py | Runtime Error | 639 | 24608 | 954 | n, m = map(int, input().split())
sus = [[] for i in range(n)]
eq = [1 for i in range(n)]
for i in range(m):
a, b = map(int, input().split())
sus[a - 1].append(b - 1)
sus[b - 1].append(a - 1)
valid = [True for i in range(n)]
def dfs(x):
ret = 1
valid[x] = False
for y in sus[x]:
if valid... |
s262293390 | p03579 | u798181098 | 1507515427 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1758 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include... |
s622760734 | p03579 | u257374434 | 1507514228 | Python | Python (3.4.3) | py | Runtime Error | 603 | 44680 | 1268 | from collections import deque,defaultdict
N ,M =list(map(int,input().split()))
AB =[ [int(x)-1 for x in input().split()] for _ in range(M)]
d =defaultdict(list)
for a,b in AB:
d[a].append(b)
d[b].append(a)
def check(i):
dists = [-1 for _ in range(N)]
dists[i]=0
q = deque([ (1,val)for val in d... |
s690175571 | p03579 | u257374434 | 1507513836 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 58092 | 1215 | from collections import deque,defaultdict
N ,M =list(map(int,input().split()))
AB =[ [int(x)-1 for x in input().split()] for _ in range(M)]
d =defaultdict(list)
for a,b in AB:
d[a].append(b)
d[b].append(a)
def check(i):
dists = [-1 for _ in range(N)]
dists[i]=0
q = deque([ (1,val)for val in d... |
s773737564 | p03579 | u257374434 | 1507513556 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 58220 | 1220 | from collections import deque,defaultdict
N ,M =list(map(int,input().split()))
AB =[ [int(x)-1 for x in input().split()] for _ in range(M)]
d =defaultdict(list)
for a,b in AB:
d[a].append(b)
d[b].append(a)
def check(i):
dists = [-1 for _ in range(N)]
dists[i]=0
q = deque([ (1,val)for val in d... |
s090491589 | p03579 | u205803237 | 1507513458 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 33 | import networkx as nx
print("a") |
s342603743 | p03580 | u499381410 | 1596302232 | Python | PyPy3 (7.3.0) | py | Runtime Error | 174 | 108160 | 1933 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... |
s003706045 | p03580 | u499381410 | 1596302196 | Python | PyPy3 (7.3.0) | py | Runtime Error | 286 | 111412 | 1959 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... |
s036794347 | p03580 | u499381410 | 1596301665 | Python | PyPy3 (7.3.0) | py | Runtime Error | 183 | 108224 | 1955 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... |
s042259638 | p03580 | u499381410 | 1596301621 | Python | PyPy3 (7.3.0) | py | Runtime Error | 186 | 102392 | 1952 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... |
s820700471 | p03580 | u499381410 | 1596299179 | Python | PyPy3 (7.3.0) | py | Runtime Error | 179 | 108132 | 1975 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... |
s703846708 | p03580 | u499381410 | 1596299025 | Python | PyPy3 (7.3.0) | py | Runtime Error | 185 | 108428 | 1931 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... |
s450792815 | p03580 | u499381410 | 1596298968 | Python | PyPy3 (7.3.0) | py | Runtime Error | 174 | 108196 | 1891 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... |
s564751192 | p03580 | u140862547 | 1534291741 | Python | Python (3.4.3) | py | Runtime Error | 305 | 6804 | 1138 | n = int(input())
s = input()
res = []
count = 0
if s[0] == '1':one = 1
else:one = 0
temp = []
tar = 0
for i in range(1,n-1):
if s[i-1:i+2] == '101': # 碰到了101
tar = 1
temp.append(one)
one = 0 # 任务重新计数
else:
if s[i] == '0' and tar == 1: # 在任务中碰到了连续0,结束任务
... |
s503144897 | p03580 | u140862547 | 1534291708 | Python | Python (3.4.3) | py | Runtime Error | 282 | 6932 | 1143 | n = int(input())
s = input()
res = []
count = 0
if s[0] == '1':one = 1
else:one = 0
temp = []
tar = 0
for i in range(1,n-1):
if s[i-1:i+2] == '101': # 碰到了101
tar = 1
temp.append(one)
one = 0 # 任务重新计数
else:
if s[i] == '0' and tar == 1: # 在任务中碰到了连续0,结束任务
... |
s560859303 | p03580 | u499259667 | 1515537669 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3060 | 202 | N,M,K = map(int,input().split())
if K ==0:
print("Yes")
exit()
for n in range(N):
for m in range(M):
if n*m+(N-n)*(M-m) == K:
print("Yes")
exit()
print("No")
|
s556120185 | p03580 | u104282757 | 1507603146 | Python | Python (3.4.3) | py | Runtime Error | 97 | 12200 | 1421 | # D
N = int(input())
s = list(map(int, list(input())))
def calc_add(temp_list):
if len(temp_list) <= 1:
return 0
else:
res = 0
# use 101 for left
dp_l = [0]*len(temp_list)
# use 101 for right
dp_r = [0]*len(temp_list)
# do not use 101
dp... |
s857247793 | p03580 | u104282757 | 1507602743 | Python | Python (3.4.3) | py | Runtime Error | 385 | 12200 | 1587 | # D
N = int(input())
s = list(map(int, list(input())))
res = 0
L = 0
for i in range(N):
if s[i] == 1:
L = i
break
for i in range(N):
if s[i] == 1:
M = i
def calc_add(temp_list):
if len(temp_list) <= 1:
return 0
else:
res = 0
# use 101 f... |
s865298238 | p03580 | u104282757 | 1507602089 | Python | Python (3.4.3) | py | Runtime Error | 318 | 12200 | 1642 | # D
N = int(input())
s = list(map(int, list(input())))
res = 0
i = 0
L = 0
for i in range(N):
if s[i] == 1:
L = i
break
for i in range(N):
if s[i] == 1:
M = i
def calc_add(temp_list):
return sum(temp_list)
def calc_add_2(temp_list):
if len(temp_list) <= 1:
... |
s289319653 | p03580 | u104282757 | 1507602029 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 1641 | # D
N = int(input())
s = list(map(int, list(input())))
res = 0
i = 0
L = 0
for i in range(N):
if s[i] == 1:
L = i
break
for i in range(N):
if s[i] == 1:
M = i
def calc_add(temp_list):
return sum(temp_list)
def calc_add_2(temp_list)
if len(temp_list) <= 1:
... |
s199443191 | p03580 | u104282757 | 1507601131 | Python | Python (3.4.3) | py | Runtime Error | 438 | 12200 | 1589 | # D
N = int(input())
s = list(map(int, list(input())))
res = 0
i = 0
L = 0
for i in range(N):
if s[i] == 1:
L = i
break
for i in range(N):
if s[i] == 1:
M = i
def calc_add(temp_list):
if len(temp_list) <= 1:
return 0
else:
res = 0
# u... |
s518853409 | p03580 | u104282757 | 1507600602 | Python | Python (3.4.3) | py | Runtime Error | 419 | 12200 | 1591 | # D
N = int(input())
s = list(map(int, list(input())))
res = 0
i = 0
L = 0
for i in range(N):
if s[i] == 1:
L = i
break
for i in range(N):
if s[i] == 1:
M = i
def calc_add(temp_list):
if len(temp_list) <= 1:
return 0
else:
res = 0
# u... |
s627979263 | p03580 | u098968285 | 1507518276 | Python | PyPy3 (2.4.0) | py | Runtime Error | 177 | 38256 | 906 | # def makelist(n, m):
# return [[0 for i in range(m)] for j in range(n)]
N = int(input())
s = input()
dp = []
cnt = [0]*2
cnt[int(s[0])] += 1
for i in range(1, N):
if i == N-1:
else:
now = int(s[i])
if cnt[now] > 0:
cnt[now] += 1
else:
anti = (cnt + 1) % 2... |
s165602194 | p03580 | u104282757 | 1507517985 | Python | Python (3.4.3) | py | Runtime Error | 275 | 12200 | 734 | # D
N = int(input())
s = list(map(int, list(input())))
res = 0
i = 0
temp_list = [0]
L = 0
for i in range(N):
if s[i] == 1:
L = i
break
for i in range(N):
if s[i] == 1:
M = i
for i in range(L, M+1):
if i == M:
# stop add calculate
if temp_list[0] == 0:
... |
s056904426 | p03580 | u297574184 | 1507517569 | Python | Python (3.4.3) | py | Runtime Error | 204 | 15020 | 694 | N = int(input())
s = input()
while s.count('000'):
s = s.replace('000', '00')
ss = s.split('00')
A = []
for si in ss:
num = 0
ai = []
for c in si:
if c == '1':
num += 1
else:
if num > 0:
ai.append(num)
num = 0
if num > 0:
... |
s277956929 | p03580 | u330205771 | 1507516972 | Python | Python (3.4.3) | py | Runtime Error | 517 | 7956 | 678 | N = int(input())
s = list(input())
count = 0
idx = 0
while True:
if N - 2 <= idx:
break
if s[idx:idx + 3] == ['1', '0', '1']:
countL = 1
for i in range(0, idx)[::-1]:
if s[i] == '0':
break
countL += 1
countR = 1
for i in range(id... |
s719523759 | p03580 | u813238682 | 1507516361 | Python | Python (3.4.3) | py | Runtime Error | 2129 | 522148 | 1132 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
TARGET_S = "101"
ALETERED_S = "010"
TARGET_S_LEN = 2
def position_generator(ctarget_string):
"""
Test:
>>> position_generator("101000101")
[0, 6]
"""
ret_list = []
search_pos = 0
while ctarget_string.find(TARGET_S, search_pos) != -1:
... |
s911193171 | p03580 | u846372029 | 1507516131 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 6976 | 557 | # D - 101 to 010
n = int(input())
s = input()
ss = s
cnt=0
while "1011" in ss:
#print(ss)
i = ss.find("1011")
j = i+2
while ss[j]=="1" and j<n:
#print(j)
j+=1
cnt+=j-i-2
ss = ss[:i] + "0"*(j-i-3)+"010" + ss[j:]
while "101" in ss:
#print("F")
m= len(ss)
i = 0... |
s678452276 | p03580 | u751663243 | 1507516095 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 489376 | 766 | N = map(int,input())
S = input()
def solve(S):
if len(S)<3:
return 0
if len(S) == 3:
if S == '101':
return 1
else:
return 0
for i in range(len(S)):
if S[i] == '1':
break
for j in range(i,len(S)):
if S[j] == '0':
brea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.