buggy_code stringlengths 11 625k | fixed_code stringlengths 17 625k | bug_type stringlengths 2 4.45k | language int64 0 8 | token_count int64 5 200k | change_count int64 0 100 |
|---|---|---|---|---|---|
#include <stdio.h>
int n, size[101], t[101][101], cost[101][101], distance[101];
void spp(int x, int y) {
int i;
distance[x] = y;
for (i = 0; i < size[x]; i++) {
if (distance[t[x][i]] > y + cost[x][i])
spp(t[x][i], y + cost[x][i]);
}
}
int main() {
int i, j;
scanf("%d", &n);
for (i = 0; i <... | #include <stdio.h>
int n, size[101], t[101][101], cost[101][101], distance[101];
void spp(int x, int y) {
int i;
distance[x] = y;
for (i = 0; i < size[x]; i++) {
if (distance[t[x][i]] > y + cost[x][i])
spp(t[x][i], y + cost[x][i]);
}
}
int main() {
int i, j;
scanf("%d", &n);
for (i = 0; i <... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 286 | 2 |
#include <stdio.h>
#define MAX 100
#define INFTY 100000000
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n, M[MAX][MAX];
void dijkstra(void) {
int minv, i, v;
int d[MAX], color[MAX];
for (i = 0; i < n; i++) {
d[i] = INFTY;
color[i] = WHITE;
}
int u;
d[0] = 0;
color[0] = GRAY;
while (1) ... | #include <stdio.h>
#define MAX 100
#define INFTY 100000000
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n, M[MAX][MAX];
void dijkstra(void) {
int minv, i, v;
int d[MAX], color[MAX];
for (i = 0; i < n; i++) {
d[i] = INFTY;
color[i] = WHITE;
}
int u;
d[0] = 0;
color[0] = GRAY;
while (1) ... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]] | 0 | 439 | 2 |
#include <stdio.h>
#define N 100
#define INF 1000000
int n, d[N], pi[N], u, color[N], k, w[N][N];
void initializeSingleSource() {
int v = 0;
for (v = 0; v < n; v++) {
d[v] = INF;
pi[v] = NULL;
color[v] = 1;
}
d[0] = 0;
}
void dijkstra() {
int mincost, i, v, sum = 0, p;
initializeSingleSourc... |
#include <stdio.h>
#define N 1000
#define INF 1000000
int n, d[N], pi[N], u, color[N], k, w[N][N];
void initializeSingleSource() {
int v = 0;
for (v = 0; v < n; v++) {
d[v] = INF;
pi[v] = NULL;
color[v] = 1;
}
d[0] = 0;
}
void dijkstra() {
int mincost, i, v, sum = 0, p;
initializeSingleSo... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22]] | 0 | 424 | 4 |
class Node
attr_reader :id, :siblings
attr_accessor :state
def initialize(id)
@id = id
@siblings = []
@distances = {}
@state = :white
end
def add(sibling, distance)
@siblings << sibling
@distances[sibling.id] = distance
end
def distance_from(other)
@distances[other.id]
end... | class Node
attr_reader :id, :siblings
attr_accessor :state
def initialize(id)
@id = id
@siblings = []
@distances = {}
@state = :white
end
def add(sibling, distance)
@siblings << sibling
@distances[sibling.id] = distance
end
def distance_from(other)
@distances[other.id]
end... | [["-", 8, 736, 0, 662, 12, 738, 12, 652, 486, 22], ["+", 8, 736, 0, 662, 12, 738, 12, 652, 486, 22], ["-", 0, 662, 12, 738, 12, 652, 3, 4, 0, 22], ["+", 0, 662, 12, 738, 12, 652, 3, 4, 0, 22]] | 4 | 321 | 4 |
INFTY = 100000000
n = int( input() )
graph = {}
for i in range(n):
In = list(map( int , input().split('') ))
u = In[0]
k = In[1]
graph[u] = {}
for j in range(k):
v = In[2+j*2]
c = In[2+j*2+1]
graph[u][v] = c
da = {}
visited = {}
for i in range(n):
da[i] = INFTY
visited[i] = False
s = 0
da[s]... | INFTY = 100000000
n = int( input() )
graph = {}
for i in range(n):
In = list(map( int , input().split(' ') ))
u = In[0]
k = In[1]
graph[u] = {}
for j in range(k):
v = In[2+j*2]
c = In[2+j*2+1]
graph[u][v] = c
da = {}
visited = {}
for i in range(n):
da[i] = INFTY
visited[i] = False
s = 0
da[s... | [["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6]] | 5 | 273 | 1 |
def dijkstra(n):
inf = 10 ** 6 + 1
dist = [0] + [inf] * (n - 1)
visited = [False] * n
while not all(visited):
dmin = inf
for i, (d, v) in enumerate(zip(dist, visited)):
if dmin > d and not v:
u = i
visited[u] = True
for (v, c) in edge[u]:
... | def dijkstra(n):
inf = 10 ** 6 + 1
dist = [0] + [inf] * (n - 1)
visited = [False] * n
while not all(visited):
dmin = inf
for i, (d, v) in enumerate(zip(dist, visited)):
if dmin > d and not v:
dmin, u = d, i
visited[u] = True
for (v, c) in edge... | [["+", 64, 196, 0, 1, 0, 662, 31, 684, 0, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 684, 0, 21], ["+", 64, 196, 0, 1, 0, 662, 12, 432, 0, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 432, 0, 21]] | 5 | 211 | 4 |
#coding:utf-8
def Dijkestra(G,n):
d=[100000000000]*n
pi=[None]*n
d[0]=0
C=[]
for i in range(n):
C.append(i)
while len(C)!=0:
u=C[0]
for i in range(1,len(C)):
if d[u]>d[i]:
u=C[i]
C.remove(u)
for i in range(len(G[u])):
... | #coding:utf-8
def Dijkestra(G,n):
d=[100000000000]*n
pi=[None]*n
d[0]=0
C=[]
for i in range(n):
C.append(i)
while len(C)!=0:
u=C[0]
for i in range(1,len(C)):
if d[u]>d[C[i]]:
u=C[i]
C.remove(u)
for i in range(len(G[u])):
... | [["+", 0, 57, 15, 666, 0, 206, 206, 206, 51, 22], ["+", 0, 57, 15, 666, 0, 206, 206, 206, 0, 70], ["+", 0, 57, 15, 666, 0, 206, 206, 206, 0, 73]] | 5 | 332 | 3 |
INF = float('inf')
def dijkstra(source):
distance[source] = 0
parent[source] = -1
while True:
mincost = INF
for i in range(n):
if color[i] != 'black' and distance[i] < mincost:
mincost = distance[i]
u = i
if mincost == INF:
... | INF = float('inf')
def dijkstra(source):
distance[source] = 0
parent[source] = -1
while True:
mincost = INF
for i in range(n):
if color[i] != 'black' and distance[i] < mincost:
mincost = distance[i]
u = i
if mincost == INF:
... | [["+", 3, 4, 0, 652, 63, 319, 500, 23, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 306 | 2 |
def diikstraMethd(G, s):
# ?????????
n = len(G)
# White:0 Gyay:1 Black:2
color = [0 for _ in range(n)]
d = [INF for _ in range(n)]
p = [None for _ in range(n)]
d[s] = 0
while True:
mincost = INF
for i in range(n):
if color[i] != 2 and d[i] < mincost:
... | INF = 1000000
def diikstraMethd(G, s):
# ?????????
n = len(G)
# White:0 Gyay:1 Black:2
color = [0 for _ in range(n)]
d = [INF for _ in range(n)]
p = [None for _ in range(n)]
d[s] = 0
while True:
mincost = INF
for i in range(n):
if color[i] != 2 and d[i] < ... | [["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]] | 5 | 326 | 3 |
n = int(input())
from collections import defaultdict
G = defaultdict(list)
for i in range(n):
i = [int(i) for i in input().split()]
k = i[1]
G[i[0]] = list(zip(i[2::2],i[3::2]))
def mind(Q, d):
c = float('inf')
ret = 0
for i, j in enumerate(d):
if c > j and i in Q:
c = j
... | n = int(input())
from collections import defaultdict
G = defaultdict(list)
for i in range(n):
i = [int(i) for i in input().split()]
k = i[1]
G[i[0]] = list(zip(i[2::2],i[3::2]))
def mind(Q, d):
c = float('inf')
ret = 0
for i, j in enumerate(d):
if c > j and i in Q:
c = j
... | [["-", 0, 52, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 245 | 4 |
#include <iostream>
#include <queue>
#include <stdio.h>
#include <vector>
using namespace std;
#define MAX_N 100000
#define MAX_M 100000
#define WHITE 1
#define GREY 2
#define BLACK 3
vector<int> G[MAX_N];
int V[MAX_N];
int V_num[MAX_N];
void init(void) {
for (int i = 0; i < MAX_N; i++) {
V[i] = WHITE;
V_n... | #include <iostream>
#include <queue>
#include <stdio.h>
#include <vector>
using namespace std;
#define MAX_N 100000
#define MAX_M 100000
#define WHITE 1
#define GREY 2
#define BLACK 3
vector<int> G[MAX_N];
int V[MAX_N];
int V_num[MAX_N];
void init(void) {
for (int i = 0; i < MAX_N; i++) {
V[i] = WHITE;
V_n... | [["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 1 | 413 | 5 |
#include <bits/stdc++.h>
using namespace std;
vector<int> g[100000];
int c[100000], n;
void dfs(int r, int a) {
stack<int> s;
s.push(r);
c[r] = a;
while (!s.empty()) {
int u = s.top();
s.pop();
for (int i = 0; i < g[u].size(); i++) {
int v = g[u][i];
if (c[v] == -1) {
c[v] = a;... | #include <bits/stdc++.h>
using namespace std;
vector<int> g[100000];
int c[100000], n;
void dfs(int r, int a) {
stack<int> s;
s.push(r);
c[r] = a;
while (!s.empty()) {
int u = s.top();
s.pop();
for (int i = 0; i < g[u].size(); i++) {
int v = g[u][i];
if (c[v] == -1) {
c[v] = a;... | [["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 329 | 2 |
#include <iostream>
using namespace std;
int uni[100000];
int oya(int a) {
if (uni[a] < 0) {
return a;
} else {
uni[a] = oya(uni[a]);
return oya(uni[a]);
}
}
bool ren(int a, int b) {
a = oya(a);
b = oya(b);
if (a == b) {
return false;
} else {
return true;
}
}
int main() {
in... | #include <iostream>
using namespace std;
int uni[100000];
int oya(int a) {
if (uni[a] < 0) {
return a;
} else {
uni[a] = oya(uni[a]);
return oya(uni[a]);
}
}
bool ren(int a, int b) {
a = oya(a);
b = oya(b);
if (a == b) {
return false;
} else {
return true;
}
}
int main() {
in... | [["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 262 | 4 |
#include <bits/stdc++.h>
#include <stdint.h>
typedef uint32_t u32;
template <u32 N_> class UnionFindTree {
private:
u32 par[N_];
u32 rank[N_];
public:
UnionFindTree(u32 n) {
assert(n < N_);
for (u32 i = 0; i < n; ++i) {
par[i] = i;
rank[i] = 0;
}
return;
}
int find(u32 x) {
... | #include <bits/stdc++.h>
#include <stdint.h>
typedef uint32_t u32;
template <u32 N_> class UnionFindTree {
private:
u32 par[N_];
u32 rank[N_];
public:
UnionFindTree(u32 n) {
assert(n < N_);
for (u32 i = 0; i < n; ++i) {
par[i] = i;
rank[i] = 0;
}
return;
}
int find(u32 x) {
... | [["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]] | 1 | 337 | 2 |
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define MAX_N 500000
vector<int> X[MAX_N];
queue<int> Q;
int COLOR[MAX_N], N, M, Q1, A, B;
int main() {
cin >> N >> M;
for (int i = 0; i < M; i++) {
cin >> A >> B;
X[A].push_back(B);
X[B].push_back(A);
}
int cnt = 0;
for (... | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define MAX_N 500000
vector<int> X[MAX_N];
queue<int> Q;
int COLOR[MAX_N], N, M, Q1, A, B;
int main() {
cin >> N >> M;
for (int i = 0; i < M; i++) {
cin >> A >> B;
X[A].push_back(B);
X[B].push_back(A);
}
int cnt = 0;
for (... | [["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 294 | 4 |
#include <iostream>
#include <queue>
#include <set>
using namespace std;
const int MAX_N = 100000;
int G[MAX_N];
set<int> A[MAX_N];
void assign_gid(int user_num) {
int gid;
queue<int> Q;
Q.push(0);
G[0] = gid = 0;
while (!Q.empty()) {
int c = Q.front();
Q.pop();
if (G[c] == -1)
G[c] = ... | #include <iostream>
#include <queue>
#include <set>
using namespace std;
const int MAX_N = 100000;
int G[MAX_N];
set<int> A[MAX_N];
void assign_gid(int user_num) {
int gid;
queue<int> Q;
Q.push(0);
G[0] = gid = 0;
while (!Q.empty()) {
int c = Q.front();
Q.pop();
if (G[c] == -1)
G[c] = ... | [["+", 0, 57, 64, 9, 0, 7, 8, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 57, 64, 9, 0, 7, 8, 9, 0, 46]] | 1 | 366 | 6 |
#include <iostream>
using namespace std;
#include <stdio.h>
int *P;
int root(int a) {
if (P[a] == a)
return a;
P[a] = root(P[a]);
return P[a];
}
void join(int a, int b) {
int x = root(a), y = root(b);
x = P[y];
}
bool same(int a, int b) { return (root(a) == root(b) ? true : false); }
int main() {
i... | #include <iostream>
using namespace std;
#include <stdio.h>
int *P;
int root(int a) {
if (P[a] == a)
return a;
P[a] = root(P[a]);
return P[a];
}
void join(int a, int b) {
int x = root(a), y = root(b);
P[x] = y;
}
bool same(int a, int b) { return (root(a) == root(b) ? true : false); }
int main() {
i... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22]] | 1 | 283 | 6 |
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
//#define int long long
#define DBG 1
#define dump(o) \
if (DBG) { \
cerr << #o << " " << o << endl; ... | #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
//#define int long long
#define DBG 1
#define dump(o) \
if (DBG) { \
cerr << #o << " " << o << endl; ... | [["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 412 | 4 |
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
vector<vector<int>> g;
int n, m, q, s, t;
vector<bool> visited;
vector<int> color;
void dfs(int s) {
for (int i = 0; i < g[s].size(); i++) {
if (color[g[s][i]] == -1) {
color[g[s][i]] = color[s];
dfs(g[s]... | #include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
vector<vector<int>> g;
int n, m, q, s, t;
vector<bool> visited;
vector<int> color;
void dfs(int s) {
for (int i = 0; i < g[s].size(); i++) {
if (color[g[s][i]] == -1) {
color[g[s][i]] = color[s];
dfs(g[s]... | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 446 | 2 |
#include <cstdio>
#include <iostream>
#include <vector>
#define MAX 100000
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
vector<int> G[MAX];
int graphc[MAX];
int color[MAX];
int colorCount;
void def(int o) {
int v;
for (int i = 0; i < G[o].size(); i++) {
v = G[o][i];
if (color[v... | #include <cstdio>
#include <iostream>
#include <vector>
#define MAX 100000
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
vector<int> G[MAX];
int graphc[MAX];
int color[MAX];
int colorCount;
void def(int o) {
int v;
for (int i = 0; i < G[o].size(); i++) {
v = G[o][i];
if (color[v... | [["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 1 | 287 | 2 |
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;
int n;
vector<int> G[MAX];
int color[MAX];
void dfs(int r, int c) {
stack<int> S;
S.push(r);
color[r] = c;
int i, u, v;
while (!S.empty()) {
u = S.top();
S.pop();
... | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;
int n;
vector<int> G[MAX];
int color[MAX];
void dfs(int r, int c) {
stack<int> S;
S.push(r);
color[r] = c;
int i, u, v;
while (!S.empty()) {
u = S.top();
S.pop();
... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 359 | 4 |
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
const int MAX = 100000;
const int NIL = -1;
int n;
vector<int> G[MAX];
int color[MAX];
void dfs(int r, int c) {
stack<int> S;
S.push(r);
color[r] = c;
while (!S.empty()) {
int u = S.top();
S.pop();
for (int i = 0; i < G[u]... | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
const int MAX = 100000;
const int NIL = -1;
int n;
vector<int> G[MAX];
int color[MAX];
void dfs(int r, int c) {
stack<int> S;
S.push(r);
color[r] = c;
while (!S.empty()) {
int u = S.top();
S.pop();
for (int i = 0; i < G[u]... | [["-", 0, 2, 63, 118, 28, 69, 341, 342, 0, 22], ["+", 0, 2, 63, 118, 28, 69, 341, 342, 0, 22]] | 1 | 339 | 2 |
#include <iostream>
#include <vector>
using namespace std;
void set_color(const vector<vector<int>> &u, int p, vector<int> color, int c) {
if (color[p] != -1)
return;
color[p] = c;
for (int i = 0; i < u[p].size(); i++) {
set_color(u, u[p][i], color, c);
}
}
bool is_friend(const vector<vector<int>> &u,... | #include <iostream>
#include <vector>
using namespace std;
void set_color(const vector<vector<int>> &u, int p, vector<int> &color, int c) {
if (color[p] != -1)
return;
color[p] = c;
for (int i = 0; i < u[p].size(); i++) {
set_color(u, u[p][i], color, c);
}
}
bool is_friend(const vector<vector<int>> &u... | [["+", 49, 53, 54, 55, 0, 56, 49, 352, 0, 67], ["+", 0, 14, 8, 9, 0, 43, 0, 114, 0, 115]] | 1 | 304 | 3 |
#include <queue>
#include <stdio.h>
using namespace std;
const int MAX = 100000;
int parent(int table[], int child) {
queue<int> q;
while (table[child] != -1) {
q.push(child);
child = table[child];
}
while (!q.empty()) {
table[q.front()] = child;
q.pop();
}
return child;
}
int main() {
... | #include <queue>
#include <stdio.h>
using namespace std;
const int MAX = 100000;
int parent(int table[], int child) {
queue<int> q;
while (table[child] != -1) {
q.push(child);
child = table[child];
}
while (!q.empty()) {
table[q.front()] = child;
q.pop();
}
return child;
}
int main() {
... | [["-", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22]] | 1 | 305 | 8 |
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
static const int MAX = 10000;
static const int NIL = -1;
int n;
vector<int> G[MAX];
int color[MAX];
void dfs(int r, int c) {
stack<int> S;
S.push(r);
color[r] = c;
while (!S.empty()) {
int u = S.top();
S.pop();
for (int i ... | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;
int n;
vector<int> G[MAX];
int color[MAX];
void dfs(int r, int c) {
stack<int> S;
S.push(r);
color[r] = c;
while (!S.empty()) {
int u = S.top();
S.pop();
for (int i... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 350 | 6 |
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;
int n;
vector<int> G[MAX];
int color[MAX];
void dfs(int r, int c) {
stack<int> S;
S.push(r);
color[r] = c;
while (!S.empty()) {
int u = S.top();
S.pop();
for (int i... | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;
int n;
vector<int> G[MAX];
int color[MAX];
void dfs(int r, int c) {
stack<int> S;
S.push(r);
color[r] = c;
while (!S.empty()) {
int u = S.top();
S.pop();
for (int i... | [["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 1 | 359 | 2 |
//
//
// ad-algoD.cpp - created by us162022
//
#include <iostream>
using namespace std;
int find(int join[], int x) {
if (x == join[x])
return x;
return join[x];
}
int main(int argc, char *argv[]) {
int n, m, join[100000], num[100000], s, t;
cin >> n >> m;
for (int i = 0; i < n; i++) {
join[i] = i;... | //
//
// ad-algoD.cpp - created by us162022
//
#include <iostream>
using namespace std;
int find(int join[], int x) {
if (x == join[x])
return x;
return find(join, join[x]);
}
int main(int argc, char *argv[]) {
int n, m, join[100000], num[100000], s, t;
cin >> n >> m;
for (int i = 0; i < n; i++) {
... | [["+", 0, 14, 8, 9, 0, 37, 0, 2, 63, 22], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 21], ["+", 0, 37, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 25]] | 1 | 271 | 5 |
#include <cstdio>
#include <cstring>
#include <stack>
#include <vector>
using namespace std;
#define MAXN 100000
#define NIL -1
int n;
vector<int> G[MAXN];
int color[MAXN];
void dfs(int r, int c) {
stack<int> S;
S.push(r);
color[r] = c;
while (!S.empty()) {
int u = S.top();
S.pop();
for (int i = 0... | #include <cstdio>
#include <cstring>
#include <stack>
#include <vector>
using namespace std;
#define MAXN 100000
#define NIL -1
int n;
vector<int> G[MAXN];
int color[MAXN];
void dfs(int r, int c) {
stack<int> S;
S.push(r);
color[r] = c;
while (!S.empty()) {
int u = S.top();
S.pop();
for (int i = 0... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]] | 1 | 367 | 2 |
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
const int MAX = 1e5 + 9;
int idx[MAX] = {0};
void init() {
int i;
for (i = 0; i < MAX; i++)
idx[i] = i;
}
int findroot(int i) {
while (i != idx[i])
i = idx[i];
return i;
}
void munion(int u, int v) {
u = findroot(u);
v = findroot(v);
... | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
const int MAX = 1e5 + 9;
int idx[MAX] = {0};
void init() {
int i;
for (i = 0; i < MAX; i++)
idx[i] = i;
}
int findroot(int i) {
while (i != idx[i])
i = idx[i];
return i;
}
void munion(int u, int v) {
u = findroot(u);
v = findroot(v);
... | [["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 236 | 4 |
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
void numbering(int id, int *g, int num, std::vector<int> *a) {
int tmp;
for (int i = 0; i < a[id].size(); i++) {
tmp = a[id][i];
if (g[tmp])
continue;
g[tmp] = num;
numbering(tmp, g, num, a);
}
}
void grouping(std::v... | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
void numbering(int id, int *g, int num, std::vector<int> *a) {
int tmp;
for (int i = 0; i < a[id].size(); i++) {
tmp = a[id][i];
if (g[tmp])
continue;
g[tmp] = num;
numbering(tmp, g, num, a);
}
}
void grouping(std::v... | [["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]] | 1 | 371 | 2 |
#include <iostream>
#include <stack>
#include <vector>
//求解图的联通分量
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;
int n;
vector<int> G[MAX];
int color[MAX];
void dfs(int r, int c) {
stack<int> S;
S.push(r);
color[r] = c;
while (!S.empty()) {
int u = S.top();
S.pop()... | #include <iostream>
#include <stack>
#include <vector>
//求解图的联通分量
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;
int n;
vector<int> G[MAX];
int color[MAX];
void dfs(int r, int c) {
stack<int> S;
S.push(r);
color[r] = c;
while (!S.empty()) {
int u = S.top();
S.pop()... | [["-", 0, 2, 63, 118, 28, 69, 341, 342, 0, 22], ["+", 0, 2, 63, 118, 28, 69, 341, 342, 0, 22]] | 1 | 349 | 2 |
import sys
readline = sys.stdin.readline
def MAIN():
n, m = map(int, input().split())
li = [i for i in range(n)]
def f(a):
if li[a] == a:
return a
li[a] = f(li[a])
return li[a]
def f2(a, b):
if li[a] == a:
li[a] = b
return
f2(li... | import sys
readline = sys.stdin.readline
def MAIN():
n, m = map(int, input().split())
li = [i for i in range(n)]
def f(a):
if li[a] == a:
return a
li[a] = f(li[a])
return li[a]
def f2(a, b):
if li[a] == a:
li[a] = b
return
f2(li... | [["-", 0, 41, 0, 666, 0, 652, 3, 4, 0, 22], ["+", 0, 41, 0, 666, 0, 652, 3, 4, 0, 22]] | 5 | 229 | 4 |
def dfs(r, c):
global color, G
S = [r]
color[r] = c
while (0 < len(S)):
u = S.pop()
for u in G[u]:
v = color[u]
if (v == None):
color[u] = c
S.append(u)
def assignColor():
global color, G, n
c = 1
for i in range(n):
... | def dfs(r, c):
global color, G
S = [r]
color[r] = c
while (0 < len(S)):
u = S.pop()
for u in G[u]:
v = color[u]
if (v == None):
color[u] = c
S.append(u)
def assignColor():
global color, G, n
c = 1
for i in range(n):
... | [["-", 0, 656, 0, 1, 0, 662, 12, 658, 8, 685], ["+", 0, 1, 0, 662, 12, 658, 8, 634, 0, 70], ["+", 0, 1, 0, 662, 12, 658, 8, 634, 0, 73], ["-", 0, 656, 0, 1, 0, 662, 12, 658, 8, 147], ["+", 0, 656, 0, 1, 0, 662, 12, 658, 8, 685]] | 5 | 267 | 5 |
# coding: UTF-8
from collections import deque
n,m = map(int,input().split())
link = [[] for _ in range(n)]
part = [-1 for _ in range(n)]
for _ in range(m):
u,v = map(int,input().split())
link[u].append(v)
link[v].append(u)
searched = set()
queue = deque()
pindex = 0
for u in range(n):
if u not in searched:
... | # coding: UTF-8
from collections import deque
n,m = map(int,input().split())
link = [[] for _ in range(n)]
part = [-1 for _ in range(n)]
for _ in range(m):
u,v = map(int,input().split())
link[u].append(v)
link[v].append(u)
searched = set()
queue = deque()
pindex = 0
for u in range(n):
if u not in searched:
... | [["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]] | 5 | 253 | 4 |
config = {
input : 'tmp',
newline : '\r\n'
}; // win
// config = { input: '/dev/stdin', newline: '\n' }; // linux
A = require('fs')
.readFileSync(config.input, 'ascii')
.trim()
.split(config.newline)
.map(function(line) { return line.trim().split(' ').map(Number); });
n = Number(A.s... | // config = { input: 'tmp', newline: '\r\n' }; // win
config = {
input : '/dev/stdin',
newline : '\n'
}; // linux
A = require('fs')
.readFileSync(config.input, 'ascii')
.trim()
.split(config.newline)
.map(function(line) { return line.trim().split(' ').map(Number); });
n = Number(A.s... | [["-", 0, 11, 12, 500, 0, 569, 51, 557, 0, 491], ["+", 0, 11, 12, 500, 0, 569, 51, 557, 0, 491], ["-", 0, 11, 12, 500, 0, 569, 51, 557, 0, 44]] | 2 | 243 | 3 |
n=int(input())
M=[[-1]*n for _ in[0]*n]
for _ in[0]*n:
e=list(map(int,input().split()))
for i in range(e[1]):k=2*-~i;M[e[0]][e[k]]=e[k+1]
d=[0]+[1e6]*~-n
c=[1]*n
while 1:
m,u=1e6,-1
for i in range(n):
if m>d[i]and c[i]:m,u=d[i],i
if u<0:break
c[u]=0
for v in range(n):
if c[v]and 1+M[u][v]and d[v]>d[u]+M[u][v... | n=int(input())
M=[[-1]*n for _ in[0]*n]
for _ in[0]*n:
e=list(map(int,input().split()))
for i in range(e[1]):k=2*-~i;M[e[0]][e[k]]=e[k+1]
d=[0]+[1e6]*~-n
c=[1]*n
while 1:
m,u=1e6,-1
for i in range(n):
if m>d[i]and c[i]:m,u=d[i],i
if u<0:break
c[u]=0
for v in range(n):
if c[v]and 1+M[u][v]and d[v]>d[u]+M[u][v... | [["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]] | 5 | 241 | 2 |
// config = { input: 'tmp', newline: '\r\n' }; // win
config = {
input : '/dev/stdin',
newline : '\n'
}; // linux
const assert = require('assert');
line = require('fs')
.readFileSync(config.input, 'ascii')
.trim()
.split(config.newline);
n = Number(line.shift());
V = {};
w = {};
f... | // config = { input: 'tmp', newline: '\r\n' }; // win
config = {
input : '/dev/stdin',
newline : '\n'
}; // linux
const assert = require('assert');
line = require('fs')
.readFileSync(config.input, 'ascii')
.trim()
.split(config.newline);
n = Number(line.shift());
V = {};
w = {};
f... | [["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 48]] | 2 | 896 | 2 |
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
const int Max = 10000;
const int Infty = (1 << 21);
const int white = 0, gray = 1, black = 2;
int d[Max], color[Max];
int n;
vector<pair<int, int>> adj[Max];
void dijkstra(int s) {
priority_queue<pair<int, int>> PQ;
... | #include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
const int Max = 10000;
const int Infty = (1 << 21);
const int white = 0, gray = 1, black = 2;
int d[Max], color[Max];
int n;
vector<pair<int, int>> adj[Max];
void dijkstra(int s) {
priority_queue<pair<int, int>> PQ;
... | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 453 | 2 |
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;
#define int(x) \
int x; \
scan... | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;
#define int(x) \
int x; \
scan... | [["+", 0, 2, 3, 4, 0, 91, 28, 23, 0, 24], ["+", 0, 2, 3, 4, 0, 91, 28, 23, 0, 25]] | 1 | 427 | 2 |
#include <iostream>
using namespace std;
#include <cstdio>
#include <queue>
#include <utility>
#include <vector>
typedef vector<pair<int, int>> adj;
struct current_cost {
int index, cost;
bool operator<(const current_cost &cur) const { return cost < cur.cost; }
};
current_cost init(int i, int c) {
current_cost... | #include <iostream>
using namespace std;
#include <cstdio>
#include <queue>
#include <utility>
#include <vector>
typedef vector<pair<int, int>> adj;
struct current_cost {
int index, cost;
bool operator<(const current_cost &cur) const { return cost > cur.cost; }
};
current_cost init(int i, int c) {
current_cost... | [["-", 0, 14, 8, 9, 0, 37, 0, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 47]] | 1 | 481 | 2 |
///
// File: alds1_12_c.cpp
// Author: ymiyamoto
//
// Created on Wed Oct 18 22:36:29 2017
//
#include <cstdint>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define SIZE 10000
struct route_t {
uint32_t node;
int64_t weight;
bool operator<(const route_t &r) const { return weig... | ///
// File: alds1_12_c.cpp
// Author: ymiyamoto
//
// Created on Wed Oct 18 22:36:29 2017
//
#include <cstdint>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define SIZE 10000
struct route_t {
uint32_t node;
int64_t weight;
bool operator<(const route_t &r) const { return weig... | [["-", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 49, 50, 51, 118, 28, 69, 28, 69, 28, 22], ["+", 49, 50, 51, 118, 28, 69, 341, 342, 0, 70], ["+", 49, 50, 51, 118, 28, 69, 341, 342, 0, 22], ["+", 49, 50, 51, 118, 28, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 43, 49, 50, 51, 118, 17, 131], ["+", 8, 9, 0, 43, 49, 50, 51, 118... | 1 | 398 | 7 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 100000
#define EMAX 500000
#define INFTY 2000000000
typedef struct {
int pre, next, x;
} Cost;
int n, d[MAX];
Cost E[EMAX];
void jr(int);
void jr(int cou) {
int i, tmp;
for (i = 0; i < n; i++) {
d[i] = INFTY;
}
d[0] = 0;
tmp = 1;... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 100000
#define EMAX 500000
#define INFTY 2000000000
typedef struct {
int pre, next, x;
} Cost;
int n, d[MAX];
Cost E[EMAX];
void jr(int);
void jr(int cou) {
int i, tmp;
for (i = 0; i < n; i++) {
d[i] = INFTY;
}
d[0] = 0;
tmp = 1;
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 332 | 8 |
#include <algorithm>
#include <iostream>
#include <queue>
using namespace std;
static const int MAX = 10000;
static const int INFTY = (1 << 20);
int n;
vector<pair<int, int>> G[MAX];
void dij() {
priority_queue<pair<int, int>> PQ;
int color[MAX], d[MAX], i, j, u, v;
for (i = 0; i < n; i++) {
d[i] = INFTY;
... | #include <algorithm>
#include <iostream>
#include <queue>
using namespace std;
static const int MAX = 10000;
static const int INFTY = (1 << 20);
int n;
vector<pair<int, int>> G[MAX];
void dij() {
priority_queue<pair<int, int>> PQ;
int color[MAX], d[MAX], i, j, u, v;
for (i = 0; i < n; i++) {
d[i] = INFTY;
... | [["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]] | 1 | 440 | 2 |
#include <iostream>
#include <queue>
using namespace std;
#define INFTY (1 << 30)
//???????????????
enum Color {
WHITE,
GRAY,
BLACK,
};
// SSSP
void Dijkstra(vector<pair<int, int>> *v_w_m, int verNum) {
//???????¨????
priority_queue<pair<int, int>> pQ;
int distance[10000];
Color color[10000];
int pa... | #include <iostream>
#include <queue>
using namespace std;
#define INFTY (1 << 30)
//???????????????
enum Color {
WHITE,
GRAY,
BLACK,
};
// SSSP
void Dijkstra(vector<pair<int, int>> *v_w_m, int verNum) {
//???????¨????
priority_queue<pair<int, int>> pQ;
int distance[10000];
Color color[10000];
int pa... | [["-", 0, 14, 8, 9, 0, 43, 49, 84, 0, 48], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 0, 70], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 0, 73], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]] | 1 | 485 | 6 |
#include <cstdio>
#include <map>
#include <vector>
using namespace std;
int main() {
int n = 0, N, i, j, k, c;
scanf("%d", &N);
vector<map<int, int>> dist(N);
vector<bool> used(N);
vector<int> cost(N);
for (; n < N; n++) {
cost[n] = 9999999;
for (scanf("%d%d", &i, &k); k--; dist[j][i] = c)
sca... | #include <cstdio>
#include <map>
#include <vector>
using namespace std;
int main() {
int n = 0, N, i, j, k, c;
scanf("%d", &N);
vector<map<int, int>> dist(N);
vector<bool> used(N);
vector<int> cost(N);
for (; n < N; n++) {
cost[n] = 9999999;
for (scanf("%d%d", &i, &k); k--; dist[i][j] = c)
sca... | [["-", 26, 11, 31, 69, 28, 69, 341, 342, 0, 22], ["+", 26, 11, 31, 69, 28, 69, 341, 342, 0, 22], ["-", 0, 7, 26, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 7, 26, 11, 31, 69, 341, 342, 0, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]] | 1 | 324 | 6 |
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
typedef pair<int, int> P;
typedef pair<P, P> PP;
int main(void) {
int i, j, k, u, n, flg[101], v, c, sum, ky[101], t, min, g;
PP ke[101];
scanf("%d", &... | #include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
typedef pair<int, int> P;
typedef pair<P, P> PP;
int main(void) {
int i, j, k, u, n, flg[10001], v, c, sum, ky[10001], t, min, g;
PP ke[10001];
scanf("... | [["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]] | 1 | 399 | 6 |
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
#define MAX_N 100
#define INF 100
int cost[MAX_N][MAX_N];
int d[MAX_N];
bool used[MAX_N];
int V;... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
#define MAX_N 100
#define INF 100000 * 100 + 1
int cost[MAX_N][MAX_N];
int d[MAX_N];
bool used[M... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]] | 1 | 329 | 2 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const ... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const ... | [["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151]] | 1 | 474 | 4 |
#include <iostream>
using namespace std;
static const int MAX = 100;
static const int INF = 1 << 21;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
int n, A[MAX][MAX];
void dijkstra() {
int color[MAX], mincost, k, p[MAX], d[MAX];
for (int i = 0; i > n; i++) {
color[i] = WH... | #include <iostream>
using namespace std;
static const int MAX = 100;
static const int INF = 1 << 21;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
int n, A[MAX][MAX];
void dijkstra() {
int color[MAX], mincost, k, p[MAX], d[MAX];
for (int i = 0; i < n; i++) {
color[i] = WH... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]] | 1 | 453 | 2 |
#include <iostream>
using namespace std;
#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define INFTY 99999999
int color[MAX];
int M[MAX][MAX];
int d[MAX];
int p[MAX];
int n;
int dijkstra(int s) {
int mincost;
int u;
for (int i = 0; i < n; i++) {
d[i] = INFTY;
p[i] = -1;
}
d[s] =... | #include <iostream>
using namespace std;
#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define INFTY 99999999
int color[MAX];
int M[MAX][MAX];
int d[MAX];
int p[MAX];
int n;
int dijkstra(int s) {
int mincost;
int u;
for (int i = 0; i < n; i++) {
d[i] = INFTY;
p[i] = -1;
}
d[s] =... | [["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151]] | 1 | 445 | 4 |
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
struct Edge {
int from, to, weight;
Edge(int from, int to, int weight) : from(from), to(to), weight(weight) {}
};
struct Node {
std::vector<Edge> ongoingEdges;
void addEdge(Edge edge) { ongoingEdges.push_back(edge); }
};
class Graph {
... | #include <iostream>
#include <queue>
#include <utility>
#include <vector>
struct Edge {
int from, to, weight;
Edge(int from, int to, int weight) : from(from), to(to), weight(weight) {}
};
struct Node {
std::vector<Edge> ongoingEdges;
void addEdge(Edge edge) { ongoingEdges.push_back(edge); }
};
class Graph {
... | [["-", 31, 16, 31, 16, 31, 16, 12, 16, 17, 72], ["-", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13]] | 1 | 473 | 2 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct Edge {
ll t, w;
};
struct State {
ll v;
ll score;
bool operator<(const State &tgt) const { return score > tgt.score; }
};
vector<ll> dijkstra(vector<vector<Edge>> &G, const int start) {
const ll V = G.size();
vector<ll> res(V, I... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct Edge {
ll t, w;
};
struct State {
ll v;
ll score;
bool operator<(const State &tgt) const { return score > tgt.score; }
};
vector<ll> dijkstra(vector<vector<Edge>> &G, const int start) {
const ll V = G.size();
vector<ll> res(V, I... | [["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22]] | 1 | 353 | 2 |
#include <bits/stdc++.h>
using namespace std;
static const int M = 10000;
static const int INF = (1 << 20);
int n;
vector<pair<int, int>> a[M];
void dijkstra() {
priority_queue<pair<int, int>> Q;
int col[M];
int d[M];
for (int i = 0; i < n; i++) {
col[i] = 0;
d[i] = INF;
}
d[0] = 0;
col[0] = 1;
... | #include <bits/stdc++.h>
using namespace std;
static const int M = 10000;
static const int INF = (1 << 20);
int n;
vector<pair<int, int>> a[M];
void dijkstra() {
priority_queue<pair<int, int>> Q;
int col[M];
int d[M];
for (int i = 0; i < n; i++) {
col[i] = 0;
d[i] = INF;
}
d[0] = 0;
col[0] = 1;
... | [["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]] | 1 | 427 | 2 |
#include <iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
int n, M[MAX][MAX];
void dijkstra() {
int minv;
int color[MAX], d[MAX];
for (int i = 0; i < n; i++) {
d[i] = INFTY;
... | #include <iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
int n, M[MAX][MAX];
void dijkstra() {
int minv;
int color[MAX], d[MAX];
for (int i = 0; i < n; i++) {
d[i] = INFTY;
... | [["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]] | 1 | 443 | 2 |
//#include "stdc++.h"
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
//#include "my_gettime.hpp"
//#include "my_random.hpp"
//#include "my_util.hpp"
// using namespace std;
struct Edge {
Edge(int f, int s, int w) {
first = f;
second = s;
w... | //#include "stdc++.h"
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
//#include "my_gettime.hpp"
//#include "my_random.hpp"
//#include "my_util.hpp"
// using namespace std;
struct Edge {
Edge(int f, int s, int w) {
first = f;
second = s;
w... | [["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 118, 119, 120], ["+", 0, 1, 0, 2, 3, 4, 0, 118, 119, 120]] | 1 | 782 | 6 |
#include <algorithm>
#include <iostream>
#include <stdio.h>
using namespace std;
#define INF 1 << 21
int main() {
long long int min, n, u, k, v, c, dist[100][100], s, cost[100], t[100], l = 1;
cin >> n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
dist[i][j] = INF;
cost[i] = INF;
... | #include <algorithm>
#include <iostream>
#include <stdio.h>
using namespace std;
#define INF 1 << 21
int main() {
long long int min, n, u, k, v, c, dist[100][100], s, cost[100], t[100], l = 1;
cin >> n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
dist[i][j] = INF;
cost[i] = INF;
... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]] | 1 | 372 | 2 |
#include <algorithm>
#include <iostream>
#include <vector>
#define MAX_V 100
#define INF 1e9
using namespace std;
int cost[MAX_V][MAX_V];
int d[MAX_V];
bool used[MAX_V];
int V;
void dijkstra(int s) {
for (int i = 0; i < V; i++) {
d[i] = INF;
used[i] = false;
}
d[s] = 0;
while (true) {
int v = -1;
... | #include <algorithm>
#include <iostream>
#include <vector>
#define MAX_V 100
#define INF 1e9
using namespace std;
int cost[MAX_V][MAX_V];
int d[MAX_V];
bool used[MAX_V];
int V;
void dijkstra(int s) {
for (int i = 0; i < V; i++) {
d[i] = INF;
used[i] = false;
}
d[s] = 0;
while (true) {
int v = -1;
... | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 366 | 4 |
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
// info
int board[8][8];
int res[8];
void fillBoard(int row, int col, int cnt);
void printBoard();
void recur(int row);
int main() {
fill(res, res + 8, -1);
// rep(i, 8){
// fill(b... | #include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
// info
int board[8][8];
int res[8];
void fillBoard(int row, int col, int cnt);
void printBoard();
void recur(int row);
int main() {
fill(res, res + 8, -1);
// rep(i, 8){
// fill(b... | [["-", 0, 16, 12, 23, 0, 41, 64, 5, 0, 6]] | 1 | 431 | 1 |
#include <iostream>
using namespace std;
#define N 8
#define FREE -1
#define NOT_FREE 1
int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1];
bool X[N][N];
void initialize() {
for (int i = 0; i < N; i++) {
row[i] = FREE;
col[i] = FREE;
}
for (int i = 0; i < 2 * N - 1; i++) {
dpos[i] = FREE;
d... |
#include <iostream>
using namespace std;
#define N 8
#define FREE -1
#define NOT_FREE 1
int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1];
bool X[N][N];
void initialize() {
for (int i = 0; i < N; i++) {
row[i] = FREE;
col[i] = FREE;
}
for (int i = 0; i < 2 * N - 1; i++) {
dpos[i] = FREE;
... | [["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]] | 1 | 489 | 2 |
import copy
n = int(input())
dotsa = []
for _ in range(n):
y,x = map(int,input().split(" "))
dotsa.append([y,x])
pattern = []
pattern.append(dotsa)
for y in range(8):
nextpattern = []
#print("#######")
#print(pattern)
for pat in pattern:
#print(";;;;;;;;;;;;;;;;;;;;;")
#prin... | import copy
n = int(input())
dotsa = []
for _ in range(n):
y,x = map(int,input().split(" "))
dotsa.append([y,x])
pattern = []
pattern.append(dotsa)
for y in range(8):
nextpattern = []
#print("#######")
#print(pattern)
for pat in pattern:
#print(";;;;;;;;;;;;;;;;;;;;;")
#prin... | [["-", 0, 662, 31, 206, 51, 206, 206, 206, 206, 612], ["+", 0, 662, 31, 206, 51, 206, 206, 206, 206, 612], ["-", 0, 1, 0, 662, 31, 206, 206, 206, 206, 612], ["+", 0, 1, 0, 662, 31, 206, 206, 206, 206, 612]] | 5 | 279 | 4 |
def ask(X,Y):
cost=[0]
for j in Y:
for i in range(len(cost)-1,-1,-1):
a=X.find(c,cost[i])+1
if a:
if i+1<len(cost):
cost[i+1]=min(cost[i+1],a)
else:
cost.append(a)
return len(cost)-1
q=int(input())
Z=[]
for p in range(q):
X=input()
Y=input()
z=ask(X,Y)
Z.append(z)
for p in range(q)... | def ask(X,Y):
cost=[0]
for j in Y:
for i in range(len(cost)-1,-1,-1):
a=X.find(j,cost[i])+1
if a:
if i+1<len(cost):
cost[i+1]=min(cost[i+1],a)
else:
cost.append(a)
return len(cost)-1
q=int(input())
Z=[]
for p in range(q):
X=input()
Y=input()
z=ask(X,Y)
Z.append(z)
for p in range(q)... | [["-", 0, 662, 12, 657, 31, 652, 3, 4, 0, 22], ["+", 0, 662, 12, 657, 31, 652, 3, 4, 0, 22]] | 5 | 157 | 2 |
def f(x,y):
list=[0]
for z in y:
for i in range(len(list)-1,-1,-1):
tmp=x.find(z,list[i])+1
if tmp:
if i+1 < len(list):
list[i+1]=min(list[i+1],tmp)
else:
list.append(tmp)
return len(list)-1
n=int(input())
for i in range(q):
x=input()
y=input()
print(f(x,y))
|
def f(x,y):
list=[0]
for z in y:
for i in range(len(list)-1,-1,-1):
tmp=x.find(z,list[i])+1
if tmp:
if i+1 < len(list):
list[i+1]=min(list[i+1],tmp)
else:
list.append(tmp)
return len(list)-1
n=int(input())
for i in range(n):
x=input()
y=input()
print(f(x,y))
| [["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]] | 5 | 133 | 2 |
def edit_distance():
s = input()
t = input()
a = len(s)
b = len(t)
x = [0 for i in range(b+1)]
for i in range(a):
q = s[i]
x2 = x1+[]
for j in range(b):
if (q ==t[j]):
x[j+1] =x2[j]+1
elif (x[j+1]<x[j]):
x[j+1] =x2[j]
return x1[-1]
n = eval(input())
for i2 in range(n):
print(edit_dist... | def edit_distance():
s = input()
t = input()
a = len(s)
b = len(t)
x = [0 for i in range(b+1)]
for i in range(a):
q = s[i]
x2 = x+[]
for j in range(b):
if (q ==t[j]):
x[j+1] =x2[j]+1
elif (x[j+1]<x[j]):
x[j+1] =x[j]
return x[-1]
n = eval(input())
for i2 in range(n):
print(edit_distan... | [["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 64, 196, 0, 1, 0, 662, 12, 206, 51, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 206, 51, 22], ["-", 0, 14, 8, 196, 0, 37, 0, 206, 51, 22], ["+", 0, 14, 8, 196, 0, 37, 0, 206, 51, 22]] | 5 | 146 | 6 |
def solve():
X = input()
Y = input()
a = len(X)
b = len(Y)
c1 = [0 for i in range(b+1)]
for i in range(a):
c2 = c1 + []
for j in range(b):
if X[i] == Y[j]:
c1[j+1] = c2[j] + 1
elif c1[j+1] < c1[j]:
c1[j+1] = c1[j]
return c1[-1]
n = eval(input())
for k in range(q):... | def solve():
X = input()
Y = input()
a = len(X)
b = len(Y)
c1 = [0 for i in range(b+1)]
for i in range(a):
c2 = c1 + []
for j in range(b):
if X[i] == Y[j]:
c1[j+1] = c2[j] + 1
elif c1[j+1] < c1[j]:
c1[j+1] = c1[j]
return c1[-1]
n = eval(input())
for k in range(n):... | [["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]] | 5 | 139 | 2 |
def solve():
x = input()
y = input()
a, b = len(x), len(y)
x1 = [0 for k in range(b+1)]
for i in range(a):
e1 = x[i]
x2 = x1+" "
for j in range(b):
if e1 == y[j]:
x1[j+1] = x2[j] + 1
elif x1[j+1] < x1[j]:
x1[j+1] = x1[... | def solve():
x = input()
y = input()
a, b = len(x), len(y)
x1 = [0 for k in range(b+1)]
for i in range(a):
e1 = x[i]
x2 = x1+[]
for j in range(b):
if e1 == y[j]:
x1[j+1] = x2[j] + 1
elif x1[j+1] < x1[j]:
x1[j+1] = x1[j... | [["-", 0, 1, 0, 662, 12, 657, 12, 557, 0, 654], ["-", 0, 1, 0, 662, 12, 657, 12, 557, 0, 6], ["-", 0, 1, 0, 662, 12, 657, 12, 557, 0, 655], ["+", 0, 1, 0, 662, 12, 657, 12, 634, 0, 70], ["+", 0, 1, 0, 662, 12, 657, 12, 634, 0, 73]] | 5 | 144 | 5 |
import sys
def lcs():
seq1 = input()
seq2 = input()
a, b = len(seq1), len(seq2)
x1 = [0 for i in range(b+1)]
for i in range(a):
e1 = seq1[i]
x2 = x1 + []
for j in range(b):
if e1 == seq2[j]:
x1[j+1] = x2[j] + i
if x1[j+1] < x1[j] ... | import sys
def lcs():
seq1 = input()
seq2 = input()
a, b = len(seq1), len(seq2)
x1 = [0 for i in range(b+1)]
for i in range(a):
e1 = seq1[i]
x2 = x1 + []
for j in range(b):
if e1 == seq2[j]:
x1[j+1] = x2[j] + 1
if x1[j+1] < x1[j] ... | [["-", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612]] | 5 | 145 | 2 |
q = int(input())
def lcss(x,y):
lcs = [0]*(len(x)+1)
for i in range(len(y)):
w1 = y[i]
lcs_2 = lcs[:]
for j in range(len(x)):
if x[j] == w1:
lcs[j+1] = lcs_2[j] + 1
elif lcs[j+1] < lcs[j]:
lcs[j+1] = lcs[j]
return lcs[-1... | q = int(input())
def lcss(x,y):
lcs = [0]*(len(x)+1)
for i in range(len(y)):
w1 = y[i]
lcs_2 = lcs[:]
for j in range(len(x)):
if x[j] == w1:
lcs[j+1] = lcs_2[j] + 1
elif lcs[j+1] < lcs[j]:
lcs[j+1] = lcs[j]
return lcs[-1... | [["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21]] | 5 | 156 | 22 |
def lcs(s1, s2):
dp = []
for s2_k in s2:
bgn_idx = 0
for i, cur_idx in enumerate(dp):
chr_idx = s1.find(s2, bgn_idx) + 1
if not chr_idx:
break
dp[i] = min(cur_idx, chr_idx)
bgn_idx = cur_idx
else:
chr_idx = s1.fi... | def lcs(s1, s2):
dp = []
for s2_k in s2:
bgn_idx = 0
for i, cur_idx in enumerate(dp):
chr_idx = s1.find(s2_k, bgn_idx) + 1
if not chr_idx:
break
dp[i] = min(cur_idx, chr_idx)
bgn_idx = cur_idx
else:
chr_idx = s1.... | [["-", 0, 662, 12, 657, 31, 652, 3, 4, 0, 22], ["+", 0, 662, 12, 657, 31, 652, 3, 4, 0, 22]] | 5 | 139 | 4 |
def Ics(x, y):
a = len(x)
b = len(y)
c1 = [0] * (b + 1)
for i in range(a):
d = x[i]
c2 = c1[:]
for j in range(n):
if d == y[j]:
c1[j + 1] = c2[j] + 1
elif c1[j + 1] < c1[j]:
c1[j + 1] = c1[j]
return (c1[-1])
q = int(in... | def Ics(x, y):
a = len(x)
b = len(y)
c1 = [0] * (b + 1)
for i in range(a):
d = x[i]
c2 = c1[:]
for j in range(b):
if d == y[j]:
c1[j + 1] = c2[j] + 1
elif c1[j + 1] < c1[j]:
c1[j + 1] = c1[j]
return (c1[-1])
q = int(in... | [["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]] | 5 | 176 | 2 |
i=input
for _ in[0]*int(i()):
X,z=i(),[]
for y in i():
s=i=0
for k in z:
t=X.find(y,s)+1
if t<1:break
if t<k:z[i]=t
s=k;i+=1
else:
t=X.find(y,s)+1
if t:z+=[t]
print(len(z))
| e=input
for _ in[0]*int(e()):
X,z=e(),[]
for y in e():
s=i=0
for k in z:
t=X.find(y,s)+1
if t<1:break
if t<k:z[i]=t
s=k;i+=1
else:
t=X.find(y,s)+1
if t:z+=[t]
print(len(z))
| [["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 12, 657, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 657, 12, 652, 3, 4, 0, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 432, 0, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 432, 0, 652, 63, 22], ["-", 0, 7, 8, 196, 0, 7, 12, 652, 63, 22],... | 5 | 109 | 8 |
import sys
f_i = sys.stdin
n = int(f_i.readline())
adj = [[]] * n
for x in f_i:
x = list(map(int, x.split()))
adj[x[0]] = [c_v for c_v in zip(x[3::2], x[2::2])]
import heapq
def dijkstra():
PQ = [(0, 0)]
isVisited = [False] * n
distance = [999900001] * n
distance[0] = 0
while PQ:
... | import sys
f_i = sys.stdin
n = int(f_i.readline())
adj = [[]] * n
for x in f_i:
x = list(map(int, x.split()))
adj[x[0]] = [c_v for c_v in zip(x[3::2], x[2::2])]
import heapq
def dijkstra():
PQ = [(0, 0)]
isVisited = [False] * n
distance = [999900001] * n
distance[0] = 0
while PQ:
... | [["-", 0, 52, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 667, 19]] | 5 | 211 | 26 |
import sys
f_i = sys.stdin
n = int(f_i.readline())
adj = [[]] * n
for x in f_i:
x = list(map(int, x.split()))
adj[x[0]] = [c_v for c_v in zip(x[3::2], x[2::2])]
import heapq
def dijkstra():
PQ = [(0, 0)]
isVisited = [False] * n
distance = [999900001] * n
distance[0] = 0
while PQ:
... | import sys
f_i = sys.stdin
n = int(f_i.readline())
adj = [[]] * n
for x in f_i:
x = list(map(int, x.split()))
adj[x[0]] = (c_v for c_v in zip(x[3::2], x[2::2]))
import heapq
def dijkstra():
PQ = [(0, 0)]
isVisited = [False] * n
distance = [999900001] * n
distance[0] = 0
while PQ:
... | [["-", 8, 196, 0, 1, 0, 662, 12, 658, 0, 70], ["+", 8, 196, 0, 1, 0, 662, 12, 668, 0, 24], ["+", 12, 668, 0, 659, 12, 652, 3, 4, 0, 25], ["-", 8, 196, 0, 1, 0, 662, 12, 658, 0, 73], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 147], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 146]] | 5 | 211 | 26 |
V=int(input())
G=[[] for i in range(V)]
d=[1001001001 for i in range(V)]
used=[False for i in range(V)]
import heapq
def dijkstra(s):
q=[]
d[s]=0
heapq.heappush(q,(0, s))
while(len(q)):
p=heapq.heappop(q)
v=p[1]
used[v]=true
if d[v]<p[0]:
... | V=int(input())
G=[[] for i in range(V)]
d=[1001001001 for i in range(V)]
used=[False for i in range(V)]
import heapq
def dijkstra(s):
q=[]
d[s]=0
heapq.heappush(q,(0, s))
while(len(q)):
p=heapq.heappop(q)
v=p[1]
used[v]=True
if d[v]<p[0]:
... | [["-", 0, 52, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 12, 146]] | 5 | 271 | 2 |
from heapq import*
I=float("inf")
def m():
n=int(input())
A=[]
for _ in[0]*n:
e=list(map(int,input().split()))
A+=[zip(e[2::2],e[3::2])]
d=[0]+[I]*n
H=[(0,0)]
while H:
u=heappop(H)[1]
for v,c in A[u]:
t=d[u]+c
if d[v]>t:
d[v]=t
heappush(H,(t,v))
print('\n'.join(f'{i} {d[i]}'for i in[0]*n))
... | from heapq import*
I=float("inf")
def m():
n=int(input())
A=[]
for _ in[0]*n:
e=list(map(int,input().split()))
A+=[zip(e[2::2],e[3::2])]
d=[0]+[I]*n
H=[(0,0)]
while H:
u=heappop(H)[1]
for v,c in A[u]:
t=d[u]+c
if d[v]>t:
d[v]=t
heappush(H,(t,v))
print('\n'.join(f'{i} {d[i]}'for i in range(n... | [["-", 3, 668, 0, 659, 12, 657, 31, 634, 0, 70], ["-", 3, 668, 0, 659, 12, 657, 31, 634, 0, 612], ["-", 3, 668, 0, 659, 12, 657, 31, 634, 0, 73], ["-", 0, 652, 3, 668, 0, 659, 12, 657, 17, 48], ["+", 0, 652, 3, 668, 0, 659, 12, 652, 63, 22], ["+", 3, 668, 0, 659, 12, 652, 3, 4, 0, 24], ["+", 3, 668, 0, 659, 12, 652, 3,... | 5 | 184 | 22 |
import java.util.Scanner;
public class Main {
static int[][] ban;
static boolean[] fix;
static boolean flg = false;
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int cnt = Integer.parseInt(s.nextLine());
ban = new int[8][8];
fix = new boolean[8];
for (int i =... | import java.util.Scanner;
public class Main {
static int[][] ban;
static boolean[] fix;
static boolean flg = false;
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int cnt = Integer.parseInt(s.nextLine());
ban = new int[8][8];
fix = new boolean[8];
for (int i =... | [["-", 64, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 64, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["-", 75, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 75, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["-", 3, 4, 0, 492, 500, 492, 3, 4, 0, 24], ["-", 3, 4, 0, 492, 500, 492, 3, 4, 0, 25], ["-", 0, 1, 0, 492, 3, 4, 0, 492, 0, 131], ["-", 0, 1, 0, 492, ... | 3 | 627 | 8 |
#define _CRT_SECURE_NO_WARNINGS
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define INPUT_FILE_NAME "InputData.txt"
#define MAX_BUF 255
#define BY_STDIN 1
#define BY_FILE 0
#define TRUE 1
#define FALSE 0
#define QUEEN_NUM 8
typedef struct boardStatus {
int queenPosition[QUEEN_NUM]; /* ?????????????????... | #define _CRT_SECURE_NO_WARNINGS
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define INPUT_FILE_NAME "InputData.txt"
#define MAX_BUF 255
#define BY_STDIN 1
#define BY_FILE 0
#define TRUE 1
#define FALSE 0
#define QUEEN_NUM 8
typedef struct boardStatus {
int queenPosition[QUEEN_NUM]; /* ?????????????????... | [["-", 15, 23, 0, 16, 31, 2, 3, 4, 0, 22], ["+", 15, 23, 0, 16, 31, 2, 3, 4, 0, 22]] | 0 | 1,082 | 2 |
#include <stdio.h>
#define N 8
#define FREE 0
#define NOT_FREE 1
int row[N], col[N], dpos[15], dneg[15];
void printBoard() {
int i, j;
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
if (row[i] == j)
printf("Q");
else
printf(".");
}
printf("\n");
}
}
void putQueen(in... | #include <stdio.h>
#define N 8
#define FREE -1
#define NOT_FREE 1
int row[N], col[N], dpos[15], dneg[15];
void printBoard() {
int i, j;
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
if (row[i] == j)
printf("Q");
else
printf(".");
}
printf("\n");
}
}
void putQueen(i... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]] | 0 | 429 | 2 |
#include <stdio.h>
#define N 8
#define FREE 1
#define NOTFREE -1
int row[N], col[N], dpos[N + N - 1], dneg[N + N - 1];
int a[N][N];
void printBoard(void);
void putQueen(int i) {
int j;
if (i == N) {
printBoard();
return;
}
for (j = 0; j < N; j++) {
if (col[j] == NOTFREE || dpos[i + j] == NOTFRE... | #include <stdio.h>
#define N 8
#define FREE 1
#define NOTFREE -1
int row[N], col[N], dpos[N + N - 1], dneg[N + N - 1];
int a[N][N];
void printBoard(void);
void putQueen(int i) {
int j;
if (i == N) {
printBoard();
return;
}
for (j = 0; j < N; j++) {
if (col[j] == NOTFREE || dpos[i + j] == NOTFRE... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 0 | 503 | 2 |
#include <stdio.h>
#define N 8
#define NOTFREE 0
#define FREE 1
int r, c;
int k[N][N], row[N], col[N], dpos[15], dneg[15];
void putQueen(int i) {
int j;
if (i == N) {
printBoard();
return;
}
for (j = 0; j < N; j++) {
if (col[j] == NOTFREE || dpos[i + j] == NOTFREE ||
dneg[i - j + N - 1] ... | #include <stdio.h>
#define N 8
#define NOTFREE -1
#define FREE 1
int r, c;
int k[N][N], row[N], col[N], dpos[15], dneg[15];
void putQueen(int i) {
int j;
if (i == N) {
printBoard();
return;
}
for (j = 0; j < N; j++) {
if (col[j] == NOTFREE || dpos[i + j] == NOTFREE ||
dneg[i - j + N - 1]... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]] | 0 | 458 | 2 |
#include <math.h>
#include <stdio.h>
#define N 8
#define NOTFREE 10
#define FREE 0
void putQ(int);
int r, c, col[N], row[N], dpos[2 * N], dneg[2 * N], C[N][N];
int main() {
int n, i, j, k;
for (j = 0; j < N; j++) {
col[j] = row[j] = FREE;
}
for (j = 0; j < 2 * N; j++) {
dpos[j] = dneg[j] = FREE;
}
f... | #include <math.h>
#include <stdio.h>
#define N 8
#define NOTFREE 10
#define FREE 0
void putQ(int);
int r, c, col[N], row[N], dpos[2 * N], dneg[2 * N], C[N][N];
int main() {
int n, i, j, k;
for (j = 0; j < N; j++) {
col[j] = row[j] = FREE;
}
for (j = 0; j < 2 * N; j++) {
dpos[j] = dneg[j] = FREE;
}
f... | [["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 478 | 4 |
#include <stdbool.h>
#include <stdio.h>
#define N 8
#define FREE -1
#define NOT_FREE 1
void initialize(void);
void printBoard(void);
void recursive(int);
int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1];
bool X[N][N];
int main() {
initialize();
int i, j, k, r, c;
for (i = 0; i < N; i++) {
for (j = 0; ... | #include <stdbool.h>
#include <stdio.h>
#define N 8
#define FREE -1
#define NOT_FREE 1
void initialize(void);
void printBoard(void);
void recursive(int);
int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1];
bool X[N][N];
int main() {
initialize();
int i, j, k, r, c;
for (i = 0; i < N; i++) {
for (j = 0; ... | [["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 36, 36, 0, 30, 0, 14, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 1, 0, 11, 12, 11, 12, 11, 12, 22], ["+", 0, 1, 0, 11, 12, 11, 12, 11, 12, 22]] | 0 | 526 | 6 |
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;
/**
* Created by shoya on 2017/04/12.
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str1 = sc.next();
String str2 = sc.next();
PrintWriter pwout = new Prin... | import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;
/**
* Created by shoya on 2017/04/12.
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str1 = sc.next();
String str2 = sc.next();
PrintWriter pwout = new Prin... | [["+", 0, 195, 8, 196, 0, 1, 0, 492, 500, 22], ["+", 0, 195, 8, 196, 0, 1, 0, 492, 0, 131], ["+", 0, 195, 8, 196, 0, 1, 0, 492, 141, 22], ["+", 8, 196, 0, 1, 0, 492, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 492, 3, 4, 0, 25], ["+", 8, 498, 0, 195, 8, 196, 0, 1, 0, 35]] | 3 | 314 | 6 |
#include <stdio.h>
#include <string.h>
#define MAX 10000000
#define MAX2 100000
int main() {
int i;
int t, p;
char T[MAX], P[MAX2];
scanf("%s%s", T, P);
t = strlen(T);
p = strlen(P);
for (i = 0; i < t; i++) {
if (strncmp(&T[i], P, p) == 0) {
printf("%d\n", i);
}
}
return 0;
} | #include <stdio.h>
#include <string.h>
#define MAX 1000001
#define MAX2 10001
int main() {
int i;
int t, p;
char T[MAX], P[MAX2];
scanf("%s%s", T, P);
t = strlen(T);
p = strlen(P);
for (i = 0; i < t; i++) {
if (strncmp(&T[i], P, p) == 0) {
printf("%d\n", i);
}
}
return 0;
} | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]] | 0 | 107 | 4 |
#include <iostream>
#include <string>
using namespace std;
int main() {
string S, T;
cin >> S >> T;
if (S.size() >= T.size()) {
for (int i = 0; i <= S.size() - T.size(); i++) {
if (T[0] == S[i]) {
if (T == S.substr(i, T.size())) {
printf("%d\n", &i);
}
}
}
}
... | #include <iostream>
#include <string>
using namespace std;
int main() {
string S, T;
cin >> S >> T;
if (S.size() >= T.size()) {
for (int i = 0; i <= S.size() - T.size(); i++) {
if (T[0] == S[i]) {
if (T == S.substr(i, T.size())) {
printf("%d\n", i);
}
}
}
}
r... | [["-", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]] | 1 | 114 | 1 |
#include <bits/stdc++.h>
using namespace std;
string S, T;
main() {
cin >> S >> T;
if (S.size() >= T.size()) {
for (int i = 0; i <= S.size() - T.size(); i++) {
if (T == S.substr(i, T.size())) {
printf("%d", i);
}
}
}
} | #include <bits/stdc++.h>
using namespace std;
string S, T;
int main() {
cin >> S >> T;
if (S.size() >= T.size()) {
for (int i = 0; i <= S.size() - T.size(); i++) {
if (T == S.substr(i, T.size())) {
printf("%d\n", i);
}
}
}
} | [["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 1 | 92 | 2 |
#include "bits/stdc++.h"
using namespace std;
//#define int long long
#define DBG 1
#define dump(o) \
if (DBG) { \
cerr << #o << " " << (o) << " "; ... | #include "bits/stdc++.h"
using namespace std;
//#define int long long
#define DBG 1
#define dump(o) \
if (DBG) { \
cerr << #o << " " << (o) << " "; ... | [["-", 0, 57, 64, 1, 0, 11, 12, 16, 17, 72], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 12, 13]] | 1 | 612 | 2 |
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
string T, P;
int Tlen, Plen;
cin >> T >> P;
Tlen = T.size();
Plen = P.size();
for (int i = 0; i <= Tlen - Plen; i++) {
if (T[i] == P[0]) {
if (P == T.substr(i... | #include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
string T, P;
int Tlen, Plen;
cin >> T >> P;
Tlen = T.size();
Plen = P.size();
for (int i = 0; i <= Tlen - Plen; i++) {
if (T[i] == P[0]) {
if (P == T.substr(i... | [["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 44]] | 1 | 119 | 1 |
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
using namespace std;
queue<pair<string, int>> Q;
void Sw(string st, int x) {
int i;
int pos, npos;
int d[4] = {-3, 3, -1, 1};
string st1;
for (i = 0; i <= 8; i++) {
if (st[i] == '0') {
pos = i;
break;
}
}
for (i = ... | #include <cstdio>
#include <iostream>
#include <map>
#include <queue>
using namespace std;
queue<pair<string, int>> Q;
void Sw(string st, int x) {
int i;
int pos, npos;
int d[4] = {-3, 3, -1, 1};
string st1;
for (i = 0; i <= 8; i++) {
if (st[i] == '0') {
pos = i;
break;
}
}
for (i = ... | [["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]] | 1 | 355 | 2 |
#include <bits/stdc++.h>
using namespace std;
#define repl(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repl(i, 0, n)
#define INF INT_MAX / 3
#define N 3
typedef pair<int, int> P;
struct State {
int g, h;
string state;
P blank;
string path;
bool operator<(const State &a) const { retu... | #include <bits/stdc++.h>
using namespace std;
#define repl(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repl(i, 0, n)
#define INF INT_MAX / 3
#define N 3
typedef pair<int, int> P;
struct State {
int g, h;
string state;
P blank;
string path;
bool operator<(const State &a) const { retu... | [["-", 0, 2, 3, 4, 0, 191, 51, 83, 0, 22], ["+", 0, 2, 3, 4, 0, 191, 51, 83, 0, 22]] | 1 | 864 | 2 |
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
using namespace std;
#define N 3
#define N2 9
struct Puzzle {
int f[N2];
int space;
string path;
bool operator<(const Puzzle &p) const {
for (int i = 0; i < N2; i++) {
if (f[i] == p.f[i])
continue;
r... | #include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
using namespace std;
#define N 3
#define N2 9
struct Puzzle {
int f[N2];
int space;
string path;
bool operator<(const Puzzle &p) const {
for (int i = 0; i < N2; i++) {
if (f[i] == p.f[i])
continue;
r... | [["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 60], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32]] | 1 | 519 | 2 |
#include <cassert>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#define N 3
#define N2 8
#define LIMIT 100
using namespace std;
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct Puzzle... | #include <cassert>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#define N 3
#define N2 9
#define LIMIT 100
using namespace std;
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct Puzzle... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]] | 1 | 705 | 2 |
import heapq
def d_manhattan(node_list):
s = 0
for i in range(9):
x_goal = i%3
y_goal = i//3
x_now = (node_list[i] - 1)%3
y_now = (node_list[i] - 1)//3
if y_now == -1:
y_now = 2
dx = abs(x_now - x_goal)
dy = abs(y_now - y_goal)
s += dx... | import heapq
def d_manhattan(node_list):
s = 0
for i in range(9):
x_goal = i%3
y_goal = i//3
x_now = (node_list[i] - 1)%3
y_now = (node_list[i] - 1)//3
if y_now == -1:
y_now = 2
dx = abs(x_now - x_goal)
dy = abs(y_now - y_goal)
s += dx... | [["-", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22], ["+", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22]] | 5 | 622 | 2 |
package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
func search(in [9]byte) int {
for i := 0; i < 9; i++ {
if in[i] == byte(0) {
return i
}
}
panic("not found 0")
}
func up(in [9]byte) (bool, [9]byte) {
pos := search(in)
if pos > 2 {
in[pos], in[pos-3] = in[pos... | package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
func search(in [9]byte) int {
for i := 0; i < 9; i++ {
if in[i] == byte(0) {
return i
}
}
panic("not found 0")
}
func up(in [9]byte) (bool, [9]byte) {
pos := search(in)
if pos > 2 {
in[pos], in[pos-3] = in[pos... | [["-", 8, 196, 0, 436, 12, 432, 0, 437, 71, 22], ["+", 8, 196, 0, 436, 12, 432, 0, 437, 71, 22]] | 7 | 881 | 6 |
#include <stdio.h>
#include <stdlib.h>
int puzzle[4][4];
int tmp[4][4];
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
void empty(int *, int *);
int dfs(int, int, int, int, const int);
int cal();
void swap(int *, int *);
int main() {
int i, j, a, x, y, l;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j... | #include <stdio.h>
#include <stdlib.h>
int puzzle[4][4];
int tmp[4][4];
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
void empty(int *, int *);
int dfs(int, int, int, int, const int);
int cal();
void swap(int *, int *);
int main() {
int i, j, a, x, y, l;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]] | 0 | 713 | 2 |
row = [True] * 8
col = [True] * 8
dpos = [True] * 15
dneg = [True] * 15
board = [['.', '.', '.', '.', '.', '.', '.', '.'] for i in range(8)]
import sys
file_input = sys.stdin
k = int(file_input.readline())
for line in file_input:
r, c = map(int, line.split())
row[r] = "INIT"
col[c] = "INIT"
dpos[r... | row = [True] * 8
col = [True] * 8
dpos = [True] * 15
dneg = [True] * 15
board = [['.', '.', '.', '.', '.', '.', '.', '.'] for i in range(8)]
import sys
file_input = sys.stdin
k = int(file_input.readline())
for line in file_input:
r, c = map(int, line.split())
row[r] = "INIT"
col[c] = "INIT"
dpos[r... | [["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 654], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 655]] | 5 | 339 | 5 |
n = int(input())
nt = []
board = [["." for _ in range(8)] for _ in range(8)]
for i in range(n):
y, x = map(int, input().split())
board[y][x] = "Q"
nt.append(y)
def output():
for row in board:
print(" ".join(row))
def check(x, y):
for i in range(8):
for j in range(8):
... | n = int(input())
nt = []
board = [["." for _ in range(8)] for _ in range(8)]
for i in range(n):
y, x = map(int, input().split())
board[y][x] = "Q"
nt.append(y)
def output():
for row in board:
print("".join(row), sep=None)
def check(x, y):
for i in range(8):
for j in range(8):
... | [["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 51, 685]] | 5 | 290 | 5 |
# -*- coding: utf-8 -*-
import sys
BOARD_SIZE_W = 8
BOARD_SIZE_H = 8
def set_queen(board, queen_point):
"""
クイーンを指定座標に配置した後、残りの配置可能な位置の配列を返す
"""
return filter(create_queen_filter(queen_point), board)
def create_queen_filter(queen_point):
"""
指定位置にクイーンを配置したことにより、対象座標へ配置不可能にならないかを確認する関数を返す
... | # -*- coding: utf-8 -*-
import sys
BOARD_SIZE_W = 8
BOARD_SIZE_H = 8
def set_queen(board, queen_point):
"""
クイーンを指定座標に配置した後、残りの配置可能な位置の配列を返す
"""
return filter(create_queen_filter(queen_point), board)
def create_queen_filter(queen_point):
"""
指定位置にクイーンを配置したことにより、対象座標へ配置不可能にならないかを確認する関数を返す
... | [["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 657, 12, 557, 0, 654], ["+", 3, 4, 0, 657, 12, 557, 0, 6, 0, 44], ["+", 0, 652, 3, 4, 0, 657, 12, 557, 0, 655]] | 5 | 441 | 7 |
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.Queue;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = 9;
char[] s = new char[n];
for (int i = 0; i < n; i++) {
s[i] = (char)('0' + sc.ne... | import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.Queue;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = 9;
char[] s = new char[n];
for (int i = 0; i < n; i++) {
s[i] = (char)('0' + sc.ne... | [["+", 0, 16, 12, 16, 31, 16, 31, 23, 0, 24], ["+", 0, 16, 12, 16, 31, 16, 31, 23, 0, 25]] | 3 | 503 | 4 |
#include <stdio.h>
#include <stdlib.h>
int puzle[3][3];
int tmp[3][3];
int d1[4] = {0, 1, 0, -1};
int d2[4] = {1, 0, -1, 0};
void empty(int *x, int *y) {
int i, j;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
if (!puzle[i][j]) {
*x = j;
*y = i;
return;
}
}
}
}
... | #include <stdio.h>
#include <stdlib.h>
int puzle[3][3];
int tmp[3][3];
int d1[4] = {0, 1, 0, -1};
int d2[4] = {1, 0, -1, 0};
void empty(int *x, int *y) {
int i, j;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
if (!puzle[i][j]) {
*x = j;
*y = i;
return;
}
}
}
}
... | [["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]] | 0 | 681 | 4 |
#include <stdio.h>
#include <stdlib.h>
#define tate 3
#define yoko 3
#define Total (tate * yoko)
extern inline void down_0(void);
extern inline void up_0(void);
extern inline void right_0(void);
extern inline void left_0(void);
extern int serch(int x, int y, int MaxCnt, int pre);
extern int check(void);
int cnt, nu... | #include <stdio.h>
#include <stdlib.h>
#define tate 3
#define yoko 3
#define Total (tate * yoko)
extern inline void down_0(void);
extern inline void up_0(void);
extern inline void right_0(void);
extern inline void left_0(void);
extern int serch(int x, int y, int MaxCnt, int pre);
extern int check(void);
int cnt, nu... | [["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 16, 31, 23, 0, 16, 12, 16, 17, 33], ["+", 0, 16, 31, 23, 0, 16, 12, 16, 12, 13]] | 0 | 636 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.