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 <iostream>
#include <queue>
#include <string>
using namespace std;
//默认的优先队列是一个最大堆,当然这个最大的基准可以自己设置
int main() {
char com[20];
priority_queue<int> pq;
while (true) {
int key;
cin >> com;
if (com[0] == 'i') {
cin >> key;
pq.push(key);
} else if (com[1] == 'x') {
cout <... | #include <iostream>
#include <queue>
#include <string>
using namespace std;
//默认的优先队列是一个最大堆,当然这个最大的基准可以自己设置
int main() {
char com[20];
priority_queue<int> pq;
while (true) {
int key;
cin >> com;
if (com[0] == 'i') {
cin >> key;
pq.push(key);
} else if (com[1] == 'x') {
cout <... | [["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]] | 1 | 113 | 2 |
// AOJ Algorithms and Data Structures I - Heaps - Priority Queue
// s 2013 0913 1556
//
/*
[ヒープを表す配列A、ヒープのサイズ(要素数)をheap_sizeとすれば、A[1...heap_size]にヒープの要素が格納される。木の根はA[1]であり、節点の添え字iが与えられたとき、その親parent(i)、左の子left(i)、右の子right(i)は以下の式で算出される:
] と、問題文に書いてあるので、添え字0は使わず、獲得する領域も1大きくする。 add
2013 0913 1714
要素数が決まってないので、動的配列で作りたいが... | // AOJ Algorithms and Data Structures I - Heaps - Priority Queue
// s 2013 0913 1556
//
/*
[ヒープを表す配列A、ヒープのサイズ(要素数)をheap_sizeとすれば、A[1...heap_size]にヒープの要素が格納される。木の根はA[1]であり、節点の添え字iが与えられたとき、その親parent(i)、左の子left(i)、右の子right(i)は以下の式で算出される:
] と、問題文に書いてあるので、添え字0は使わず、獲得する領域も1大きくする。 add
2013 0913 1714
要素数が決まってないので、動的配列で作りたいが... | [["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]] | 1 | 433 | 2 |
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000003
int A[MAX];
int heap_size = 0;
int Parent(int i) { return i / 2; }
int Left(int i) { return 2 * i; }
int Right(int i) { return 2 * i + 1; }
void maxHeapify(int i) {
int l, r, largest;
int temp;
l = Left(i);
r = Right(i);
if ((l <= heap_size) && ... | #include <stdio.h>
#include <stdlib.h>
#define MAX 2000003
int A[MAX];
int heap_size = 0;
int Parent(int i) { return i / 2; }
int Left(int i) { return 2 * i; }
int Right(int i) { return 2 * i + 1; }
void maxHeapify(int i) {
int l, r, largest;
int temp;
l = Left(i);
r = Right(i);
if ((l <= heap_size) && ... | [["-", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]] | 0 | 508 | 3 |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
struct H {
int val;
H *l, *r;
H(int v) : val(v) { l = r = nullptr; }
};
H *root;
H *meld(H *h1, H *h2) {
if (h1 == nullptr)
return h2;
if (h2 == nullptr)
return h1;
if (h1->val > h2->val)
swap(h1, h2);
h1->r = me... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
struct H {
int val;
H *l, *r;
H(int v) : val(v) { l = r = nullptr; }
};
H *root;
H *meld(H *h1, H *h2) {
if (h1 == nullptr)
return h2;
if (h2 == nullptr)
return h1;
if (h1->val < h2->val)
swap(h1, h2);
h1->r = me... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]] | 1 | 246 | 2 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 2000005
#define INF 2000000010
int n = 0;
int a[N];
void swap(int *a, int *b) {
int t;
t = *a;
*a = *b;
*b = t;
}
void maxHeapify(int i) {
int l = 2 * i;
int r = 2 * i + 1;
int maxi = i;
if (l <= n && a[l] > a[maxi]) {
maxi = l;
... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 2000005
#define INF 2000000010
int n = 0;
int a[N];
void swap(int *a, int *b) {
int t;
t = *a;
*a = *b;
*b = t;
}
void maxHeapify(int i) {
int l = 2 * i;
int r = 2 * i + 1;
int maxi = i;
if (l <= n && a[l] > a[maxi]) {
maxi = l;
... | [["-", 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 | 374 | 4 |
#include <iostream>
#include <queue>
#include <string>
using namespace std;
int main() {
priority_queue<int> Q;
string s;
int n;
while (cin >> s && s != "end") {
if (s == "insert") {
cin >> n;
Q.push(n);
} else {
cout << Q.top();
Q.pop();
}
}
} | #include <iostream>
#include <queue>
#include <string>
using namespace std;
int main() {
priority_queue<int> Q;
string s;
int n;
while (cin >> s && s != "end") {
if (s == "insert") {
cin >> n;
Q.push(n);
} else {
cout << Q.top() << endl;
Q.pop();
}
}
} | [["+", 75, 76, 0, 9, 0, 1, 0, 16, 17, 151], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22]] | 1 | 80 | 2 |
#include <algorithm>
#include <stdio.h>
using namespace std;
int val, size_, heap[2097168];
char c[9];
inline void insert(int x) {
int ptr = size_++;
heap[ptr] = x;
while (ptr > 1) {
if (heap[ptr >> 1] < heap[ptr])
swap(heap[ptr], heap[ptr >> 1]);
ptr >>= 1;
}
}
inline int extract() {
int ret = ... | #include <algorithm>
#include <stdio.h>
using namespace std;
int val, size_, heap[2097168];
char c[9];
inline void insert(int x) {
int ptr = size_++;
heap[ptr] = x;
while (ptr > 1) {
if (heap[ptr >> 1] < heap[ptr])
swap(heap[ptr], heap[ptr >> 1]);
ptr >>= 1;
}
}
inline int extract() {
int ret = ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 310 | 2 |
import java.lang.*;
import java.util.*;
public class Main {
static final int INF = (1 << 31) - 1;
static final int MAXN = 11111;
public static void main(String[] args) throws Exception {
Scanner input = new Scanner(System.in);
int x0, y0, x1, y1, x2, y2;
int q;
x0 = input.nextInt();
y0 = inp... | import java.lang.*;
import java.util.*;
public class Main {
static final int INF = (1 << 31) - 1;
static final int MAXN = 11111;
public static void main(String[] args) throws Exception {
Scanner input = new Scanner(System.in);
int x0, y0, x1, y1, x2, y2;
int q;
x0 = input.nextInt();
y0 = inp... | [["-", 0, 57, 75, 57, 15, 15, 0, 16, 17, 19], ["+", 0, 57, 75, 57, 15, 15, 0, 16, 17, 18]] | 3 | 368 | 2 |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define max(a, b) a < b ? b : a
#define min(a, b) a < b ? b : a
#define POW2(a) a *a
#define ROOP(i, n) for (i = 0; i < n; i++)
#define _USE_MATH_DEFINES
typedef struct POINT {
double x;
double y;
} POINT;
typedef struct LINE {
POINT s; // start point
PO... | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define max(a, b) a < b ? b : a
#define min(a, b) a < b ? b : a
#define POW2(a) a *a
#define ROOP(i, n) for (i = 0; i < n; i++)
#define _USE_MATH_DEFINES
typedef struct POINT {
double x;
double y;
} POINT;
typedef struct LINE {
POINT s; // start point
PO... | [["-", 0, 57, 75, 76, 0, 9, 0, 37, 0, 13], ["+", 0, 57, 75, 76, 0, 9, 0, 37, 0, 13]] | 0 | 1,169 | 2 |
#include <math.h>
#include <stdio.h>
int main() {
int n, ax, ay, bx, by, cx, cy, m, bax, bay, cax, cay, u;
double t, x, y, p, q, r, s;
scanf("%d%d%d%d", &ax, &ay, &bx, &by);
scanf("%d", &n);
bax = bx - ax;
bay = by - ay;
while (n--) {
scanf("%d%d", &cx, &cy);
cax = cx - ax;
cay = cy - ay;
... | #include <math.h>
#include <stdio.h>
int main() {
int n, ax, ay, bx, by, cx, cy, m, bax, bay, cax, cay, u;
double t, x, y, p, q, r, s;
scanf("%d%d%d%d", &ax, &ay, &bx, &by);
scanf("%d", &n);
bax = bx - ax;
bay = by - ay;
while (n--) {
scanf("%d%d", &cx, &cy);
cax = cx - ax;
cay = cy - ay;
... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 371 | 2 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define pb push_back
#define mp make_pair
#define SZ(x) (int)(x).size()
typedef long long LL;
typedef pair<int, int> pii;
typedef pai... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define pb push_back
#define mp make_pair
#define SZ(x) (int)(x).size()
typedef long long LL;
typedef pair<int, int> pii;
typedef pai... | [["-", 0, 14, 8, 9, 0, 37, 0, 16, 17, 72], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 33]] | 1 | 1,011 | 2 |
#include <bits/stdc++.h>
using namespace std;
#define TemplateVersion "3.4.0"
// Useful Marcos
//====================START=====================
// Compile use C++11 and above
#ifdef LOCAL
#define debug(args...) \
{ ... | #include <bits/stdc++.h>
using namespace std;
#define TemplateVersion "3.4.0"
// Useful Marcos
//====================START=====================
// Compile use C++11 and above
#ifdef LOCAL
#define debug(args...) \
{ ... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]] | 1 | 2,534 | 6 |
#include <bits/stdc++.h>
using namespace std;
#define TemplateVersion "3.4.0"
// Useful Marcos
//====================START=====================
// Compile use C++11 and above
#ifdef LOCAL
#define debug(args...) \
{ ... | #include <bits/stdc++.h>
using namespace std;
#define TemplateVersion "3.4.0"
// Useful Marcos
//====================START=====================
// Compile use C++11 and above
#ifdef LOCAL
#define debug(args...) \
{ ... | [["-", 8, 9, 0, 37, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 37, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 22]] | 1 | 6,672 | 4 |
// Counter-Clockwise
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;
static const double ESP = 1e-10;
bool equals(double a, double b) { return fabs(a - b) < ESP; }
class Point {
public:
double x, y;
explicit Point(double x = 0, double y = 0) : x(x), y(y) {}
Point operator+(cons... | // Counter-Clockwise
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;
static const double ESP = 1e-10;
bool equals(double a, double b) { return fabs(a - b) < ESP; }
class Point {
public:
double x, y;
explicit Point(double x = 0, double y = 0) : x(x), y(y) {}
Point operator+(cons... | [["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22]] | 1 | 760 | 2 |
#include <cmath>
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;
//-------------------------------------------------------------------------------------
/*2点[(x1,y1),(x2,y2)]を入力し二点を通る直線ax+by+cの(a,b,c)を返す, */
/*x1==x2ならfalseを返す*/
/*falseならばx=cの形の直線*/
void straight_line_passing_through_th... | #include <cmath>
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;
//-------------------------------------------------------------------------------------
/*2点[(x1,y1),(x2,y2)]を入力し二点を通る直線ax+by+cの(a,b,c)を返す, */
/*x1==x2ならfalseを返す*/
/*falseならばx=cの形の直線*/
void straight_line_passing_through_th... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]] | 1 | 669 | 4 |
////////////////////////////////////////////////////////////////////////////////
// 平面幾何
// 型変換できるもの
// double -> Point
// Segment -> Line
// 誤差の話:絶対誤差でも相対誤差でも死ぬ例
// int main(){
// const double EPS = 1e-9;
// double a = 1.3, b = 1e8, c = a + b;
// c = c - b;
// printf("%d\n", equal(a, c)); // =>... | ////////////////////////////////////////////////////////////////////////////////
// 平面幾何
// 型変換できるもの
// double -> Point
// Segment -> Line
// 誤差の話:絶対誤差でも相対誤差でも死ぬ例
// int main(){
// const double EPS = 1e-9;
// double a = 1.3, b = 1e8, c = a + b;
// c = c - b;
// printf("%d\n", equal(a, c)); // =>... | [["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]] | 1 | 2,985 | 2 |
#include <bits/stdc++.h>
using namespace std;
const int dx[] = {0, 1, 0, -1, 1, -1, -1, 1};
const int dy[] = {-1, 0, 1, 0, 1, 1, -1, -1};
const int INF = 1 << 30;
const double EPS = 1e-15;
#define PB push_back
#define mk make_pair
#define fi first
#define se second
#define ll long long
#define reps(i, j, k) for (int i ... | #include <bits/stdc++.h>
using namespace std;
const int dx[] = {0, 1, 0, -1, 1, -1, -1, 1};
const int dy[] = {-1, 0, 1, 0, 1, 1, -1, -1};
const int INF = 1 << 30;
const double EPS = 1e-15;
#define PB push_back
#define mk make_pair
#define fi first
#define se second
#define ll long long
#define reps(i, j, k) for (int i ... | [["-", 0, 14, 8, 9, 0, 37, 0, 5, 0, 6], ["+", 0, 14, 8, 9, 0, 37, 0, 5, 0, 6]] | 1 | 730 | 2 |
#include <cmath>
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void) {
pair<double, double> p0, p1, p2;
int n;
cin >> p0.first >> p0.second >> p1.first >> p1.second;
cin >> n;
while (n--) {
cin >> p2.first >> p2.second;
// ??????
double crossProduct = (p1.first - p0.firs... | #include <cmath>
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void) {
pair<double, double> p0, p1, p2;
int n;
cin >> p0.first >> p0.second >> p1.first >> p1.second;
cin >> n;
while (n--) {
cin >> p2.first >> p2.second;
// ??????
double crossProduct = (p1.first - p0.firs... | [["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20]] | 1 | 322 | 2 |
#include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>
#define EPS 1e-10
using namespace std;
struct P {
double x, y;
P(double xx = 0, double yy = 0) {
x = xx;
y = yy;
}
P operator+(P &p) { return P(x + p.x, y + p.y); }
P operator-(P &p) { return P(x - p.x, y - p.y); }
P operator*(... | #include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>
#define EPS 1e-10
using namespace std;
struct P {
double x, y;
P(double xx = 0, double yy = 0) {
x = xx;
y = yy;
}
P operator+(P &p) { return P(x + p.x, y + p.y); }
P operator-(P &p) { return P(x - p.x, y - p.y); }
P operator*(... | [["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 515 | 4 |
#include <complex>
#include <iostream>
using namespace std;
typedef complex<int> point;
string ccw(point p0, point p1, point p2) {
point temp;
p1 -= p0;
p2 -= p0;
temp = p1;
p1 *= conj(p1);
p2 *= conj(p1);
if (abs(temp) == 0)
return "ON_SEGMENT";
p1 /= abs(temp);
if (p2.imag() > 0)
return "CO... | #include <complex>
#include <iostream>
using namespace std;
typedef complex<int> point;
string ccw(point p0, point p1, point p2) {
point temp;
p1 -= p0;
p2 -= p0;
temp = p1;
p1 *= conj(temp);
p2 *= conj(temp);
if (abs(temp) == 0)
return "ON_SEGMENT";
p1 /= abs(temp);
if (p2.imag() > 0)
return... | [["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]] | 1 | 244 | 4 |
#include <complex>
#include <iostream>
#include <string>
#define x real()
#define y imag()
using namespace std;
typedef complex<double> point;
typedef complex<double> vectol;
double dot(point a, point b) { return a.x * b.x + a.y * b.y; }
double cross(point a, point b) { return a.x * b.y - a.y * b.x; }
string ccw(poi... | #include <complex>
#include <iostream>
#include <string>
#define x real()
#define y imag()
using namespace std;
typedef complex<double> point;
typedef complex<double> vectol;
double dot(point a, point b) { return a.x * b.x + a.y * b.y; }
double cross(point a, point b) { return a.x * b.y - a.y * b.x; }
string ccw(poi... | [["-", 8, 9, 0, 57, 64, 37, 0, 5, 0, 6], ["+", 8, 9, 0, 57, 64, 37, 0, 5, 0, 6]] | 1 | 279 | 2 |
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
class Point {
public:
double x, y;
Point(double x = 0, double y = 0) : x(x), y(y) {}
Point operator+(Point p) { return Point(x + p.x, y + p.y); }
... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
class Point {
public:
double x, y;
Point(double x = 0, double y = 0) : x(x), y(y) {}
Point operator+(Point p) { return Point(x + p.x, y + p.y); }
... | [["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 557 | 2 |
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#define REP(i, k, n) for (int i = k; i < n; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1 << 30
#define pb push_back
#define mp make_pair
... | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#define REP(i, k, n) for (int i = k; i < n; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1 << 30
#define pb push_back
#define mp make_pair
... | [["-", 0, 37, 0, 16, 12, 16, 12, 118, 28, 22], ["+", 0, 37, 0, 16, 12, 16, 12, 118, 28, 22], ["-", 0, 37, 0, 16, 12, 16, 12, 118, 119, 120], ["+", 0, 37, 0, 16, 12, 16, 12, 118, 119, 120]] | 1 | 686 | 4 |
#include <cmath>
#include <iostream>
using namespace std;
struct vec {
double x, y;
vec operator-(vec b) {
vec &a = *this;
vec c;
c.x = a.x - b.x;
c.y = a.y - b.y;
return c;
}
};
const double eps = 0.0000001;
double inner_product(vec &a, vec &b) { return a.x * b.x + a.y * b.y; }
double out... | #include <cmath>
#include <iostream>
using namespace std;
struct vec {
double x, y;
vec operator-(vec b) {
vec &a = *this;
vec c;
c.x = a.x - b.x;
c.y = a.y - b.y;
return c;
}
};
const double eps = 0.0000001;
double inner_product(vec &a, vec &b) { return a.x * b.x + a.y * b.y; }
double out... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]] | 1 | 392 | 4 |
#include <iostream>
using namespace std;
#include <complex>
#include <cstdio>
typedef double type_n;
typedef complex<type_n> point;
void ccw(const point &a, const point &c, const point &z) {
point w;
w = conj(c) * (z - a);
type_n re = w.real(), im = w.imag();
if (re != 0) {
(re > 0 ? printf("COUNTER_CLOCK... | #include <iostream>
using namespace std;
#include <complex>
#include <cstdio>
typedef double type_n;
typedef complex<type_n> point;
void ccw(const point &a, const point &c, const point &z) {
point w;
w = conj(c) * (z - a);
type_n re = w.real(), im = w.imag();
if (im != 0) {
(im > 0 ? printf("COUNTER_CLOCK... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 0, 1, 0, 23, 0, 41, 15, 16, 31, 22], ["+", 0, 1, 0, 23, 0, 41, 15, 16, 31, 22], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22]] | 1 | 308 | 8 |
#define TEST_MODE 1
#ifndef __VECD__
#define __VECD__
#include <iomanip>
#include <iostream>
#include <numeric>
#include <vector>
#define rep(n) for (int i = 0; i < n; i++)
#define PB push_back
#define VecND VecD<std::vector<double>>
#if TEST_MODE
#define Vec3D _VecD<double, 3>
#define Vec2D _VecD<double, 2>
#endif
#e... | #define TEST_MODE 1
#ifndef __VECD__
#define __VECD__
#include <iomanip>
#include <iostream>
#include <numeric>
#include <vector>
#define rep(n) for (int i = 0; i < n; i++)
#define PB push_back
#define VecND VecD<std::vector<double>>
#if TEST_MODE
#define Vec3D _VecD<double, 3>
#define Vec2D _VecD<double, 2>
#endif
#e... | [["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19]] | 1 | 2,424 | 2 |
#include <algorithm>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
double x1, x2, xp, y1, y2, yp1, yp, naiseki, norm1, norm2, gaiseki;
int q;
scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
scanf("%d", &q);
for (int i = 0; i < q; i++) {
scanf("%lf %lf", &xp, &yp);
norm1 = sqr... | #include <algorithm>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
double x1, x2, xp, y1, y2, yp1, yp, naiseki, norm1, norm2, gaiseki;
int q;
scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
scanf("%d", &q);
for (int i = 0; i < q; i++) {
scanf("%lf %lf", &xp, &yp);
norm1 = sqr... | [["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 20]] | 1 | 311 | 2 |
#include <cmath>
#include <iostream>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int x0, y0, x1, y1;
cin >> x0 >> y0 >> x1 >> y1;
int X1 = x1 - x0, Y1 = y1 - y0;
int q;
cin >> q;
while (q--) {
int x2, y2;
cin >> x2 >> y2;
int X2 = x2 - x0, Y2 = y2 - y0;
lo... | #include <cmath>
#include <iostream>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int x0, y0, x1, y1;
cin >> x0 >> y0 >> x1 >> y1;
int X1 = x1 - x0, Y1 = y1 - y0;
int q;
cin >> q;
while (q--) {
int x2, y2;
cin >> x2 >> y2;
int X2 = x2 - x0, Y2 = y2 - y0;
lo... | [["-", 0, 43, 49, 50, 51, 16, 31, 16, 12, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 12, 22]] | 1 | 255 | 2 |
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;... | #include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["-", 0, 43, 49, 50, 51, 83, 0, 83, 0, 22], ["+", 0, 43, 49, 50, 51, 83, 0, 83, 0, 22], ["-", 49, 50, 51, 83, 0, 83, 0, 5, 0, 6], ["+", 49, 50, 51, 83, 0, 83, 0, 5, 0, 6], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 22], ["+", 0, 30, 0, ... | 1 | 1,011 | 8 |
#include <bits/stdc++.h>
#define r(i, n) for (int i = 0; i < n; i++)
using namespace std;
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
// CCW??¨///////////////////////////////////
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONELINE_BACK = 2;
static const... | #include <bits/stdc++.h>
#define r(i, n) for (int i = 0; i < n; i++)
using namespace std;
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
// CCW??¨///////////////////////////////////
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONELINE_BACK = 2;
static const... | [["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6]] | 1 | 906 | 2 |
#include <complex>
#include <cstdio>
#include <iostream>
using namespace std;
typedef complex<int> point;
double dot(point a, point b) {
// return (a*conj(b)).real();
return a.real() * b.real() + a.imag() * b.imag();
}
double cross(point a, point b) {
// return (a*conj(b)).imag();
return a.real() * b.imag() ... | #include <complex>
#include <cstdio>
#include <iostream>
using namespace std;
typedef complex<long long> point;
long double dot(point a, point b) {
// return (a*conj(b)).real();
return a.real() * b.real() + a.imag() * b.imag();
}
long double cross(point a, point b) {
// return (a*conj(b)).imag();
return a.re... | [["-", 0, 134, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 96], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18]] | 1 | 265 | 7 |
#include <bits/stdc++.h>
using namespace std;
typedef complex<double> P;
typedef complex<double> V;
typedef vector<P> vecP;
typedef pair<P, P> L;
typedef pair<P, P> S;
typedef pair<P, double> C;
const double eps = 1e-8;
const double PI = acos(-1);
const double PI2 = PI * 2.0;
namespace std {
bool operator<(const P &a,... | #include <bits/stdc++.h>
using namespace std;
typedef complex<double> P;
typedef complex<double> V;
typedef vector<P> vecP;
typedef pair<P, P> L;
typedef pair<P, P> S;
typedef pair<P, double> C;
const double eps = 1e-8;
const double PI = acos(-1);
const double PI2 = PI * 2.0;
namespace std {
bool operator<(const P &a,... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]] | 1 | 3,504 | 4 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
typedef long long int ll;
using namespace std;
const int MAX = 5000 + 10;
const double eps = 1e-9;
const double PI = acos(-1.0);
int sgn(do... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
typedef long long int ll;
using namespace std;
const int MAX = 5000 + 10;
const double eps = 1e-9;
const double PI = acos(-1.0);
int sgn(do... | [["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 479 | 6 |
///
// File: cgl_1_c.cpp
// Author: ymiyamoto
//
// Created on Mon Oct 23 00:28:22 2017
//
#include <cmath>
#include <cstdint>
#include <iomanip>
#include <iostream>
using namespace std;
struct vector_t {
double x;
double y;
vector_t(double a, double b) : x(a), y(b) {}
double norm2() { return x * x + y * y... | ///
// File: cgl_1_c.cpp
// Author: ymiyamoto
//
// Created on Mon Oct 23 00:28:22 2017
//
#include <cmath>
#include <cstdint>
#include <iomanip>
#include <iostream>
using namespace std;
struct vector_t {
double x;
double y;
vector_t(double a, double b) : x(a), y(b) {}
double norm2() { return x * x + y * y... | [["+", 0, 57, 15, 339, 51, 16, 12, 91, 17, 33]] | 1 | 575 | 1 |
#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int sign(double x) { //???????????°???????°???????????¢?
return abs(x) < EPS ? 0 : x < 0 ? -1 : 1;
}
struct Point { //????????????
double x, y;
Point(double x = 0.0, double y = 0.0) : x(x), y(y) {}
Point ope... | #include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int sign(double x) { //???????????°???????°???????????¢?
return abs(x) < EPS ? 0 : x < 0 ? -1 : 1;
}
struct Point { //????????????
double x, y;
Point(double x = 0.0, double y = 0.0) : x(x), y(y) {}
Point ope... | [["-", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22]] | 1 | 761 | 4 |
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
... | [["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 727 | 2 |
#include <array>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
const double EPSILON = 1e-10;
inline bool equals(double a, double b) { return std::fabs(a - b) < EPSILON; }
struct Point {
double x;
double y;
bool operator<(const Point &p) const { return x != p.x ? x < p.x : y < p.y; ... | #include <array>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
const double EPSILON = 1e-10;
inline bool equals(double a, double b) { return std::fabs(a - b) < EPSILON; }
struct Point {
double x;
double y;
bool operator<(const Point &p) const { return x != p.x ? x < p.x : y < p.y; ... | [["-", 0, 14, 8, 9, 0, 37, 0, 16, 17, 72], ["+", 8, 9, 0, 37, 0, 16, 12, 16, 17, 48]] | 1 | 1,228 | 2 |
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
int x_0, y_0, x_1, y_1;
int q;
int x, y;
int choice();
int gaiseki(int, int, int, int);
int naiseki(int, int, int, int);
double norm(int, int);
int main() {
cin >> x_0 >> y_0 >> x_1 >> y_1;
cin >> q;
string s[] = {"COUNTER_CLOCKWISE", ... | #include <cmath>
#include <iostream>
#include <string>
using namespace std;
int x_0, y_0, x_1, y_1;
int q;
int x, y;
int choice();
int gaiseki(int, int, int, int);
int naiseki(int, int, int, int);
double norm(int, int);
int main() {
cin >> x_0 >> y_0 >> x_1 >> y_1;
cin >> q;
string s[] = {"COUNTER_CLOCKWISE", ... | [["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 19]] | 1 | 346 | 2 |
#include <bits/stdc++.h>
using namespace std;
const int SIZE = 210;
const double eps = 1e-10;
typedef complex<double> P;
typedef double P_type;
typedef complex<P_type> P;
const P_type P_eps = 1e-8; //整数の時はゼロ
namespace std {
template <class T> bool operator<(const complex<T> &a, const complex<T> &b) {
return a.re... | #include <bits/stdc++.h>
using namespace std;
const int SIZE = 210;
const double eps = 1e-10;
typedef complex<double> P;
typedef double P_type;
typedef complex<P_type> P;
const P_type P_eps = 1e-8; //整数の時はゼロ
namespace std {
template <class T> bool operator<(const complex<T> &a, const complex<T> &b) {
return a.re... | [["+", 0, 57, 15, 339, 51, 16, 12, 91, 17, 33]] | 1 | 473 | 2 |
#include <stdio.h>
int main(void) {
int x1, y1, x2, y2, xp, yp;
scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
x2 -= x1, y2 -= y1;
int q, i;
scanf("%d", &q);
for (i = 0; i < q; ++i) {
scanf("%d%d", &xp, &yp);
xp -= x1, yp -= y1;
int op = xp * y2 - yp * x2;
if (op > 0)
printf("CLOCKWISE\n");
... | #include <stdio.h>
int main(void) {
int x1, y1, x2, y2, xp, yp;
scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
x2 -= x1, y2 -= y1;
int q, i;
scanf("%d", &q);
for (i = 0; i < q; ++i) {
scanf("%d%d", &xp, &yp);
xp -= x1, yp -= y1;
int op = xp * y2 - yp * x2;
if (op > 0)
printf("CLOCKWISE\n");
... | [["-", 31, 16, 31, 23, 0, 16, 12, 16, 17, 47], ["+", 31, 16, 31, 23, 0, 16, 12, 16, 17, 20], ["-", 31, 16, 12, 23, 0, 16, 12, 16, 17, 47], ["+", 31, 16, 12, 23, 0, 16, 12, 16, 17, 20], ["-", 31, 16, 12, 23, 0, 16, 12, 16, 17, 18], ["+", 31, 16, 12, 23, 0, 16, 12, 16, 17, 19], ["-", 51, 16, 12, 23, 0, 16, 12, 16, 17, 18... | 1 | 228 | 8 |
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
#define EPS (1e-10)
#define equals(a, b) (fabs(a - b) < EPS)
class Point {
public:
double x, y;
Point(double x_ = 0, double y_ = 0) {
x = x_;
y = y_;
}
Point operator+(Point p) { return Point(x + p.x, y + p.y); };
Point... | #include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
#define EPS (1e-10)
#define equals(a, b) (fabs(a - b) < EPS)
class Point {
public:
double x, y;
Point(double x_ = 0, double y_ = 0) {
x = x_;
y = y_;
}
Point operator+(Point p) { return Point(x + p.x, y + p.y); };
Point... | [["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 961 | 2 |
#include <stdio.h>
#include <stdlib.h>
#define MAX 250
#define NIL -1
struct Node {
int key;
int right;
int left;
int parent;
};
int main() {
int n;
int key[MAX];
struct Node node[MAX];
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &key[i]);
node[i].right = node[i].left = no... | #include <stdio.h>
#include <stdlib.h>
#define MAX 251
#define NIL -2000000001
struct Node {
int key;
int right;
int left;
int parent;
};
int main() {
int n;
int key[MAX];
struct Node node[MAX];
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &key[i]);
node[i].right = node[i].... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]] | 0 | 340 | 4 |
#include <stdio.h>
#include <stdlib.h>
int main() {
int n, i, H[250];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &H[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i + 1, H[i]);
if (i != 0)
printf("parent key = %d, ", H[i / 2]);
if (2 * i < n)
print... | #include <stdio.h>
#include <stdlib.h>
int main() {
int n, i, H[250];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &H[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, H[i]);
if (i != 1)
printf("parent key = %d, ", H[i / 2]);
if (2 * i <= n)
printf("... | [["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]] | 0 | 169 | 8 |
#include <stdio.h>
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main() {
int n, i;
scanf("%d", &n);
int A[n + 1];
for (i = 1; i <= n; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, A[i]);
... | #include <stdio.h>
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main() {
int n, i;
scanf("%d", &n);
int A[100000];
for (i = 1; i <= n; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, A[i]);
... | [["-", 8, 9, 0, 43, 49, 80, 81, 16, 31, 22], ["-", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 217 | 10 |
#include <stdio.h>
int parent(int);
int left(int);
int right(int);
int main() {
int n, i, x;
int a[250];
scanf("%d", &n);
for (i = 1; i < n + 1; i++) {
scanf("%d", &a[i]);
}
/*if(n==1)printf("node 1: key = %d, \n",a[1]);
else if(n==2)printf("node 1: key = %d, left key = %d, \n",a[1],a[2]);
else{
... |
#include <stdio.h>
int parent(int);
int left(int);
int right(int);
int main() {
int n, i, x;
int a[250];
scanf("%d", &n);
for (i = 1; i < n + 1; i++) {
scanf("%d", &a[i]);
}
/*if(n==1)printf("node 1: key = %d, \n",a[1]);
else if(n==2)printf("node 1: key = %d, left key = %d, \n",a[1],a[2]);
else{... | [["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 230 | 2 |
#include <math.h>
#include <stdio.h>
#define N 250
int parent(int i) { return floor(i / 2); }
int left(int i) { return 2 * i; }
int right(int i) { return (2 * i) + 1; }
int main() {
int n, A[N], i;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= n; i++) {
printf(... | #include <math.h>
#include <stdio.h>
#define N 250
int parent(int i) { return floor(i / 2); }
int left(int i) { return 2 * i; }
int right(int i) { return (2 * i) + 1; }
int main() {
int n, A[N], i;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= n; i++) {
printf(... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 228 | 4 |
#include <stdio.h>
int main() {
int i, H, A[251];
scanf("%d\n", &H);
for (i = 1; i <= H; i++)
scanf("%d", &A[i]);
for (i = 1; i <= H; i++) {
printf("node %d: key = %d, ", i, A[i]);
if (i / 2 >= 1)
printf("parent key = %d, ", A[i / 2]);
if (i * 2 <= H)
printf("left key = %d ", A[i * 2... | #include <stdio.h>
int main() {
int i, H, A[251];
scanf("%d\n", &H);
for (i = 1; i <= H; i++)
scanf("%d", &A[i]);
for (i = 1; i <= H; i++) {
printf("node %d: key = %d, ", i, A[i]);
if (i / 2 >= 1)
printf("parent key = %d, ", A[i / 2]);
if (i * 2 <= H)
printf("left key = %d, ", A[i * ... | [["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 164 | 4 |
#include <stdio.h>
#define H 252
int main() {
int i, n, T[H];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &T[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d,", i, T[i]);
if (i == 1) {
printf("left key = %d, right key = %d,\n", T[2 * i], T[2 * i + 1]);
} else if (2... | #include <stdio.h>
#define H 252
int main() {
int i, n, T[H];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &T[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, T[i]);
if (i == 1) {
printf("left key = %d, right key = %d, \n", T[2 * i], T[2 * i + 1]);
} else if ... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 216 | 10 |
#include <stdio.h>
int main() {
int h, A[251];
scanf("%d", &h);
int i;
for (i = 1; i <= h; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= h; i++) {
printf("node %d: key = %d, ", i, A[i]);
if (i != 1)
printf("parent key = %d,", A[(int)i / 2]);
if ((i * 2) <= h)
printf("left ke... | #include <stdio.h>
int main() {
int h, A[251];
scanf("%d", &h);
int i;
for (i = 1; i <= h; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= h; i++) {
printf("node %d: key = %d, ", i, A[i]);
if (i != 1)
printf("parent key = %d, ", A[(int)i / 2]);
if ((i * 2) <= h)
printf("left k... | [["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 175 | 2 |
#include <stdio.h>
int n;
typedef struct node {
int key;
long int parent;
int left;
int right;
} Node;
int parent(i) {
if (i == 1)
return -1;
else
return i / 2;
}
int left(i) {
if (2 * i > n)
return -1;
else
return 2 * i;
}
int right(i) {
if (2 * i + 1 > n)
return -1;
else
... | #include <stdio.h>
int n;
typedef struct node {
long int key;
long int parent;
long int left;
long int right;
} Node;
int parent(i) {
if (i == 1)
return -1;
else
return i / 2;
}
int left(i) {
if (2 * i > n)
return -1;
else
return 2 * i;
}
int right(i) {
if (2 * i + 1 > n)
retu... | [["+", 39, 122, 8, 123, 0, 124, 39, 86, 0, 96]] | 0 | 386 | 3 |
#include <stdio.h>
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main() {
int i, n;
int ary[100001];
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &ary[i]);
}
for (i = 0; i < n; i++) {
printf("node %d: key = %d, ", i + 1, a... | #include <stdio.h>
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main() {
int i, n;
int ary[100001];
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &ary[i]);
}
for (i = 0; i < n; i++) {
printf("node %d: key = %d, ", i + 1, a... | [["+", 0, 2, 3, 4, 0, 69, 71, 16, 17, 33], ["+", 0, 2, 3, 4, 0, 69, 71, 16, 12, 13]] | 0 | 223 | 6 |
#include <stdio.h>
#include <stdlib.h>
#define MAX 100000
typedef struct node *Node;
#define NIL NULL
int main() {
int i, j, n;
int A[MAX + 1];
scanf("%d", &n);
for (i = 1; i < n + 1; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i < n + 1; i++) {
printf("node %d: key %d, ", i, A[i]);
if (i > 1)
... | #include <stdio.h>
#include <stdlib.h>
#define MAX 100000
typedef struct node *Node;
#define NIL NULL
int main() {
int i, j, n;
int A[MAX + 1];
scanf("%d", &n);
for (i = 1; i < n + 1; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i < n + 1; i++) {
printf("node %d: key = %d, ", i, A[i]);
if (i > 1)
... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 187 | 6 |
#include <stdio.h>
#include <stdlib.h>
typedef struct Node Node;
struct Node {
int id;
int key;
Node *parent;
Node *right;
Node *left;
};
void initialize(Node *n);
int main() {
int size;
scanf("%d", &size);
int array[size + 1];
for (int i = 1; i <= size; i++) {
scanf("%d", &array[i]);
}
Node ... | #include <stdio.h>
#include <stdlib.h>
typedef struct Node Node;
struct Node {
int id;
int key;
Node *parent;
Node *right;
Node *left;
};
void initialize(Node *n);
int main() {
int size;
scanf("%d", &size);
int array[size + 1];
for (int i = 1; i <= size; i++) {
scanf("%d", &array[i]);
}
Node ... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 443 | 2 |
#include <stdio.h>
int main() {
int i, n;
int D[1000000];
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &D[i]);
}
for (i = 0; i < n; i++) {
printf("node %d: key = %d, ", i, D[i]);
if (i / 2 >= 1) {
printf("parent key = %d, ", D[i / 2]);
}
if (i * 2 <= n) {
printf("l... | #include <stdio.h>
int main() {
int i, n;
int D[1000000];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &D[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, D[i]);
if (i / 2 >= 1) {
printf("parent key = %d, ", D[i / 2]);
}
if (i * 2 <= n) {
printf(... | [["-", 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, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 0 | 169 | 8 |
#include <stdio.h>
#define N 2000000
int parent(int a) { return (a / 2); }
int left(int a) { return (2 * a); }
int right(int a) { return (2 * a + 1); }
int main() {
int i, Heap, T[N + 1];
scanf("%d", &Heap);
for (i = 1; i <= Heap; i++) {
scanf("%d", &T[i]);
}
for (i = 1; i <= Heap; i++) {
printf(... | #include <stdio.h>
#define N 2000000
int parent(int a) { return (a / 2); }
int left(int a) { return (2 * a); }
int right(int a) { return (2 * a + 1); }
int main() {
int i, Heap, T[N];
scanf("%d", &Heap);
for (i = 1; i <= Heap; i++) {
scanf("%d", &T[i]);
}
for (i = 1; i <= Heap; i++) {
printf("nod... | [["-", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 69, 71, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 71, 22]] | 0 | 219 | 4 |
#include <stdio.h>
int main() {
int i, n;
scanf("%d", &n);
int A[n];
for (i = 0; i < n; i++)
scanf("%d", &A[i]);
for (i = 0; i < n; i++) {
printf("node %d: key = %d,", i, A[i]);
if (i != 0)
printf(" parent key = %d,", A[(i - 1) / 2]);
if ((i + 1) * 2 >= 0 && (i + 1) * 2 <= n)
prin... | #include <stdio.h>
int main() {
int i, n;
scanf("%d", &n);
int A[n];
for (i = 0; i < n; i++)
scanf("%d", &A[i]);
for (i = 0; i < n; i++) {
printf("node %d: key = %d,", i + 1, A[i]);
if (i != 0)
printf(" parent key = %d,", A[(i - 1) / 2]);
if ((i + 1) * 2 >= 0 && (i + 1) * 2 <= n)
... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 198 | 3 |
#include <stdio.h>
#define M 100000
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main() {
int H, i, C[M + 1];
scanf("%d", &H);
for (i = 1; i <= H; i++) {
scanf("%d", &C[i]);
}
for (i = 1; i <= H; i++) {
printf("node %d: key = ... | #include <stdio.h>
#define M 100000
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main() {
int H, i, C[M + 1];
scanf("%d", &H);
for (i = 1; i <= H; i++) {
scanf("%d", &C[i]);
}
for (i = 1; i <= H; i++) {
printf("node %d: key = ... | [["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 213 | 2 |
/*Complete Binary Tree*/
#include <stdio.h>
#include <stdlib.h>
#define N 250
typedef struct node {
int key;
struct node *right;
struct node *left;
struct node *parent;
} Node;
Node a[N];
void insert(int, int);
int main() {
int i, n, k;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
a[i].parent = N... | /*Complete Binary Tree*/
#include <stdio.h>
#include <stdlib.h>
#define N 250
typedef struct node {
int key;
struct node *right;
struct node *left;
struct node *parent;
} Node;
Node a[N];
void insert(int, int);
int main() {
int i, n, k;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
a[i].parent = N... | [["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 0 | 354 | 2 |
#include <stdio.h>
#define MAX_NUMBER_OF_NODE 250
/*struct Node
{
int id;
int index_of_node;
}
*/
// struct Node node[MAX_NUMBER_OF_NODE];
int insert(int);
int main() {
int node[MAX_NUMBER_OF_NODE];
int number_of_node; // it is represented as H in AOJ
int i, id;
// for(i = 0 ; i < MAX_NUMBER_OF_NODE ;i++... | #include <stdio.h>
#define MAX_NUMBER_OF_NODE 250
/*struct Node
{
int id;
int index_of_node;
}
*/
// struct Node node[MAX_NUMBER_OF_NODE];
int insert(int);
int main() {
int node[MAX_NUMBER_OF_NODE];
int number_of_node; // it is represented as H in AOJ
int i, id;
// for(i = 0 ; i < MAX_NUMBER_OF_NODE ;i++... | [["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 182 | 2 |
#include <stdio.h>
#define MAX 100000
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return i * 2 + 1; }
int main() {
int H = 0, i, A[MAX + 1];
scanf("%d", &H);
for (i = 1; i <= H; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= H; i++) {
printf("node ... | #include <stdio.h>
#define MAX 100000
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return i * 2 + 1; }
int main() {
int H = 0, i, A[MAX + 1];
scanf("%d", &H);
for (i = 1; i <= H; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= H; i++) {
printf("node ... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 215 | 2 |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: main.c
* Author: Ivan
*
* Created on July 19, 2018, 1:58 AM
*/
#include <stdio.h>
#include <stdlib.h>
#define MAX 2... | /*
* File: main.c
* Author: s1252007
*
* Created on July 27, 2018, 12:04 PM
*/
#include <stdio.h>
#include <stdlib.h>
#define MAX 250
/*
*
*/
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main(int argc, char **argv) {
int H, T[MAX + 1];
... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 225 | 8 |
#include <stdio.h>
int main() {
int n, i;
scanf("%d", &n);
int a[n + 1];
for (i = 1; i < n + 1; i++)
scanf("%d", &a[i]);
for (i = 1; i < n + 1; i++) {
printf("node %d: key = %d, ", i, a[i]);
if (i != 1)
printf("parent key =%d, ", a[i / 2]);
if (2 * i <= n)
printf("left key =%d, ",... | #include <stdio.h>
int main() {
int n, i;
scanf("%d", &n);
int a[n + 1];
for (i = 1; i < n + 1; i++)
scanf("%d", &a[i]);
for (i = 1; i < n + 1; i++) {
printf("node %d: key = %d, ", i, a[i]);
if (i != 1)
printf("parent key = %d, ", a[i / 2]);
if (2 * i <= n)
printf("left key = %d, ... | [["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 168 | 4 |
#include <stdio.h>
int p(int a) { return a / 2; }
int left(int a) { return 2 * a; }
int right(int a) { return (2 * a) + 1; }
int main() {
int x[2000000], y, i, j, n;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &x[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d,", i, x[i]);
... | #include <stdio.h>
int p(int a) { return a / 2; }
int left(int a) { return 2 * a; }
int right(int a) { return (2 * a) + 1; }
int main() {
int x[2000000], y, i, j, n;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &x[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, x[i]);
... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 220 | 8 |
#include <stdio.h>
#define MAX 100000
main() {
int p, i;
int M[MAX + 1];
scanf("%d", &p);
for (i = 1; i <= p; i++)
scanf("%d", &M[i]);
for (i = 1; i <= p; i++) {
printf("node %d: key = %d, ", i, M[i]);
if (i / 2 >= 1)
printf("parent key=%d, ", M[i / 2]);
if (i * 2 <= p)
printf("le... | #include <stdio.h>
#define MAX 100000
main() {
int p, i;
int M[MAX + 1];
scanf("%d", &p);
for (i = 1; i <= p; i++)
scanf("%d", &M[i]);
for (i = 1; i <= p; i++) {
printf("node %d: key = %d, ", i, M[i]);
if (i / 2 >= 1)
printf("parent key = %d, ", M[i / 2]);
if (i * 2 <= p)
printf("... | [["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 169 | 6 |
#include <stdio.h>
#define MAX 250
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main() {
int i, n, A[MAX + 1];
scanf("%d", &n);
for (i = 1; i <= n; i++)
scanf("%d", &A[i]);
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i... | #include <stdio.h>
#define MAX 250
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main() {
int i, n, A[MAX + 1];
scanf("%d", &n);
for (i = 1; i <= n; i++)
scanf("%d", &A[i]);
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i... | [["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]] | 0 | 211 | 4 |
#include <stdio.h>
#define MAX 100000
int parent(int);
int left(int);
int right(int);
int main() {
int i, n;
int H[MAX];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &H[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d,", i, H[i]);
if (parent(i) >= 1) {
printf... | #include <stdio.h>
#define MAX 100000
int parent(int);
int left(int);
int right(int);
int main() {
int i, n;
int H[MAX];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &H[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, H[i]);
if (parent(i) >= 1) {
print... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 72], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 12, 13]] | 0 | 234 | 6 |
#include <stdio.h>
#include <stdlib.h>
#define MAX 100000
int parent(int i);
int left(int i);
int right(int i);
int main() {
int H, i;
int A[MAX];
scanf("%d", &H);
for (i = 1; i <= H; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= H; i++) {
printf("node %d: key - %d,", i, A[i]);
if (parent(i)... | #include <stdio.h>
#include <stdlib.h>
#define MAX 100000
int parent(int i);
int left(int i);
int right(int i);
int main() {
int H, i;
int A[MAX];
scanf("%d", &H);
for (i = 1; i <= H; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= H; i++) {
printf("node %d: key = %d, ", i, A[i]);
if (parent(i... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 241 | 8 |
#include <stdio.h>
#define MAX 250
int heap[MAX];
int main() {
int i, H, t;
scanf("%d\n", &H);
for (i = 1; i <= H; i++)
scanf("%d", &heap[i]);
for (i = 1; i <= H; i++) {
printf("node %d: key = %d, ", i, heap[i]);
if (i > 1)
printf("parent key = %d,", heap[parent(i)]);
if (left(i) <= H)
... | #include <stdio.h>
#define MAX 250
int heap[MAX];
int main() {
int i, H, t;
scanf("%d\n", &H);
for (i = 1; i <= H; i++)
scanf("%d", &heap[i]);
for (i = 1; i <= H; i++) {
printf("node %d: key = %d, ", i, heap[i]);
if (i > 1)
printf("parent key = %d, ", heap[parent(i)]);
if (left(i) <= H)... | [["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 210 | 2 |
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL
#define KMAX 100000
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main() {
int n, l, r, root;
int i, j;
int Key[KMAX + 1];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &... | #include <stdio.h>
#include <stdlib.h>
#define NIL NULL
#define KMAX 100000
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main() {
int n, l, r, root;
int i, j;
int Key[KMAX + 1];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 228 | 2 |
#include <stdio.h>
int main() {
int H[251];
int n, i;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &H[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, H[i]);
if (i / 2 >= 1 && i / 2 <= n)
printf("parent = %d, ", H[i / 2]);
if (i * 2 >= 1 && i * 2 <= n)
... | #include <stdio.h>
int main() {
int H[251];
int n, i;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &H[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, H[i]);
if (i / 2 >= 1 && i / 2 <= n)
printf("parent key = %d, ", H[i / 2]);
if (i * 2 >= 1 && i * 2 <= n... | [["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 186 | 2 |
#include <stdio.h>
#define M 100000
int parent(int a) { return a / 2; }
int left(int a) { return 2 * a; }
int right(int a) { return 2 * a + 1; }
int main() {
int i, hai[M + 1], n;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &hai[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = ... | #include <stdio.h>
#define M 100000
int parent(int a) { return a / 2; }
int left(int a) { return 2 * a; }
int right(int a) { return 2 * a + 1; }
int main() {
int i, hai[M + 1], n;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &hai[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = ... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 219 | 2 |
#include <stdio.h>
#define MAX 100000
int main() {
int t, i;
int A[MAX + 1];
scanf("%d", &t);
for (i = 1; i <= t; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= t; i++) {
printf("node %d: key = %d, ", i, A[i]);
if (i / 2 >= 1) {
printf("parent key = %d, ", A[i / 2]);
}
if (i * 2 <... | #include <stdio.h>
#define MAX 100000
int main() {
int t, i;
int A[MAX + 1];
scanf("%d", &t);
for (i = 1; i <= t; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= t; i++) {
printf("node %d: key = %d, ", i, A[i]);
if (i / 2 >= 1) {
printf("parent key = %d, ", A[i / 2]);
}
if (i * 2 <... | [["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]] | 0 | 177 | 2 |
#include <stdio.h>
#define M 10000
int parent(int n) { return n / 2; }
int left(int n) { return n * 2; }
int right(int n) { return n * 2 + 1; }
int main() {
int A[M];
int h;
int i;
scanf("%d", &h);
for (i = 1; i <= h; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= h; i++) {
printf("node %d: key ... | #include <stdio.h>
#define M 10000
int parent(int n) { return n / 2; }
int left(int n) { return n * 2; }
int right(int n) { return n * 2 + 1; }
int main() {
int A[M + 1];
int h;
int i;
scanf("%d", &h);
for (i = 1; i <= h; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= h; i++) {
printf("node %d: ... | [["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]] | 0 | 213 | 6 |
#include <stdio.h>
#define N 250
int parent(int);
int left(int);
int right(int);
int main() {
int n;
int i;
int a[N];
scanf("%d", &n);
for (i = 1; i < n + 1; i++) {
scanf("%d", &a[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, a[i]);
if (i > 1) {
printf("parent ... | #include <stdio.h>
#define N 250
int parent(int);
int left(int);
int right(int);
int main() {
int n;
int i;
int a[N];
scanf("%d", &n);
for (i = 1; i < n + 1; i++) {
scanf("%d", &a[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, a[i]);
if (i > 1) {
printf("parent ... | [["+", 8, 9, 0, 37, 0, 16, 31, 16, 17, 48]] | 0 | 235 | 1 |
#include <stdio.h>
#define heap_max 250
int main() {
int i, heap[heap_max], inHeap;
scanf("%d", &inHeap);
for (i = 1; i < inHeap + 1; i++)
scanf("%d", &heap[i]);
for (i = 1; i < inHeap + 1; i++) {
printf("node %d: key = %d,", i + 1, heap[i]);
if (i / 2 != 0)
printf(" parent key = %d,", heap... | #include <stdio.h>
#define heap_max 250
int main() {
int i, heap[heap_max], inHeap;
scanf("%d", &inHeap);
for (i = 1; i < inHeap + 1; i++)
scanf("%d", &heap[i]);
for (i = 1; i < inHeap + 1; i++) {
printf("node %d: key = %d,", i, heap[i]);
if (i / 2 != 0)
printf(" parent key = %d,", heap[i /... | [["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 174 | 3 |
#include <stdio.h>
#define MAX 250
int P(int);
int L(int);
int R(int);
int main(void) {
int i, n, h[MAX];
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &h[i]);
}
for (i = 0; i < n; i++) {
printf("node %d: key = %d, ", i, h[i]);
if (P(i) != 0) {
printf("parent key = %d, ", h[P... | #include <stdio.h>
#define MAX 250
int P(int);
int L(int);
int R(int);
int main(void) {
int i, n, h[MAX];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &h[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, h[i]);
if (P(i) != 0) {
printf("parent key = %d, ", h... | [["-", 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, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 0 | 250 | 8 |
#include <stdio.h>
#define N 250
typedef struct {
int key;
int par;
int left;
int right;
} node;
void ndset(int, int);
node T[N];
int main() {
int n, i;
scanf("%d", &n);
for (i = 0; i < n; i++)
T[i].par = -1;
for (i = 0; i < n; i++)
scanf("%d", &T[i].key);
for (i = 0; i < n; i++) {
... | #include <stdio.h>
#define N 250
typedef struct {
int key;
int par;
int left;
int right;
} node;
void ndset(int, int);
node T[N];
int main() {
int n, i;
scanf("%d", &n);
for (i = 0; i < n; i++)
T[i].par = -1;
for (i = 0; i < n; i++)
scanf("%d", &T[i].key);
for (i = 0; i < n; i++) {
... | [["+", 0, 7, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]] | 0 | 350 | 7 |
#include <stdio.h>
int main() {
int i = 0;
int x = 0;
int heap[250];
scanf("%d", &x);
for (i = 1; i <= x; i++) {
scanf("%d", &heap[i]);
}
for (i = 1; i <= x; i++) {
if (i == 1) {
printf("node %d: key = %d,", i, heap[i]);
} else {
printf("node %d: key = %d, parent key = %d, ", i,... | #include <stdio.h>
int main() {
int i = 0;
int x = 0;
int heap[250];
scanf("%d", &x);
for (i = 1; i <= x; i++) {
scanf("%d", &heap[i]);
}
for (i = 1; i <= x; i++) {
if (i == 1) {
printf("node %d: key = %d, ", i, heap[i]);
} else {
printf("node %d: key = %d, parent key = %d, ", i... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 185 | 2 |
#include <stdio.h>
#define MAX 260
#define NIL -1
int Tree[MAX];
int n;
void maxHeapify(int i) {
int largest, exchange, r, l;
l = getLeft(i);
r = getRight(i);
if (n >= l && Tree[l] > Tree[i])
largest = r;
if (largest != i) {
exchange = Tree[i];
Tree[i] = Tree[largest];
Tree[largest] = exch... | #include <stdio.h>
#define MAX 260
#define NIL -1
int Tree[MAX];
int n;
void maxHeapify(int i) {
int largest, exchange, r, l;
l = getLeft(i);
r = getRight(i);
if (n >= l && Tree[l] > Tree[i])
largest = r;
if (largest != i) {
exchange = Tree[i];
Tree[i] = Tree[largest];
Tree[largest] = exch... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 308 | 2 |
#include <stdio.h>
#define N 250
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main(void) {
int heap_size, i, A[N];
scanf("%d", &heap_size);
for (i = 1; i <= heap_size; i++)
scanf("%d", &A[i]);
for (i = 1; i <= heap_size; i++) {
p... | #include <stdio.h>
#define N 250
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main(void) {
int heap_size, i, A[N];
scanf("%d", &heap_size);
for (i = 1; i <= heap_size; i++)
scanf("%d", &A[i]);
for (i = 1; i <= heap_size; i++) {
p... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 210 | 2 |
#include <stdio.h>
#include <stdlib.h>
int main() {
int n, i;
int *node;
scanf("%d", &n);
node = malloc((n + 1) * sizeof(int));
for (i = 1; i < n + 1; i++)
scanf("%d", &node[i]);
for (i = 1; i < n + 1; i++) {
printf("node: %d: key = %d, ", i, node[i]);
if (1 <= i / 2)
printf("parent k... | #include <stdio.h>
#include <stdlib.h>
int main() {
int n, i;
int *node;
scanf("%d", &n);
node = malloc((n + 1) * sizeof(int));
for (i = 1; i < n + 1; i++)
scanf("%d", &node[i]);
for (i = 1; i < n + 1; i++) {
printf("node %d: key = %d, ", i, node[i]);
if (1 <= i / 2)
printf("parent ke... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 184 | 2 |
#include <stdio.h>
#include <stdlib.h>
int main() {
int i, n;
int *N;
scanf("%d", &n);
N = (int *)malloc(sizeof(int) * (n + 1));
for (i = 1; i <= n; i++) {
scanf("%d", &N[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d,", i, N[i]);
if (i != 1)
printf(" parent key = %d, ... | #include <stdio.h>
#include <stdlib.h>
int main() {
int i, n;
int *N;
scanf("%d", &n);
N = (int *)malloc(sizeof(int) * (n + 1));
for (i = 1; i <= n; i++) {
scanf("%d", &N[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, N[i]);
if (i != 1)
printf("parent key = %d, ... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 192 | 4 |
#include <stdio.h>
int H[251];
int main() {
int i, n;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &H[i]);
for (i = 1; i < n + 1; i++) {
printf("node %d: key = %d, ", i, H[i - 1]);
if (i / 2 >= 1)
printf("parent key = %d, ", H[i / 2 - 1]);
if (i * 2 < n + 1)
printf("left k... | #include <stdio.h>
int H[251];
int main() {
int i, n;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &H[i]);
for (i = 1; i < n + 1; i++) {
printf("node %d: key = %d, ", i, H[i - 1]);
if (i / 2 >= 1)
printf("parent key = %d, ", H[i / 2 - 1]);
if (i * 2 < n + 1)
printf("left k... | [["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 178 | 4 |
#include <stdio.h>
#define MAX 250
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int parent(int i) { return i / 2; }
int heap[MAX];
main() {
int i, size;
scanf("%d", &size);
size = size + 1;
for (i = 1; i < size; i++) {
scanf("%d", &heap[i]);
}
for (i = 1; i < size; i... | #include <stdio.h>
#define MAX 250
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int parent(int i) { return i / 2; }
int heap[MAX];
main() {
int i, size;
scanf("%d", &size);
size = size + 1;
for (i = 1; i < size; i++) {
scanf("%d", &heap[i]);
}
for (i = 1; i < size; i... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 0 | 222 | 4 |
#include <stdio.h>
#define H 251
#define NIL -1
/*
struct node{
struct node *left;
struct node *right;
struct node *parent;
int key;
}
*/
int main() {
int i, j, n;
int A[H];
scanf("%d", &n);
for (i = 0; i <= n; i++) {
A[i] = NIL;
}
for (i = 1; i <= n; i++) {
scanf("%d", &A[i]);
}
for ... | #include <stdio.h>
#define H 251
#define NIL -2000000001
/*
struct node{
struct node *left;
struct node *right;
struct node *parent;
int key;
}
*/
int main() {
int i, j, n;
int A[H];
scanf("%d", &n);
for (i = 0; i <= n; i++) {
A[i] = NIL;
}
for (i = 1; i <= n; i++) {
scanf("%d", &A[i]);
... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]] | 0 | 226 | 2 |
#include <stdio.h>
#define N 250
int parent(int n) { return n / 2; }
int left(int n) { return 2 * n; }
int right(int n) { return 2 * n + 1; }
main() {
int i, n, a[N], b;
scanf("%d", &b);
for (i = 1; i <= b; i++) {
scanf("%d", &a[i]);
}
for (i = 1; i <= b; i++) {
printf("noe %d: key = %d, ", i, a[... | #include <stdio.h>
#define N 250
int parent(int n) { return n / 2; }
int left(int n) { return 2 * n; }
int right(int n) { return 2 * n + 1; }
main() {
int i, n, a[N], b;
scanf("%d", &b);
for (i = 1; i <= b; i++) {
scanf("%d", &a[i]);
}
for (i = 1; i <= b; i++) {
printf("node %d: key = %d, ", i, a... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 217 | 2 |
#include <stdio.h>
#define MAX_H 250
struct Node {
int id; // node id
int k; // node key
int pk; // parent node key
int lk; // left node key
int rk; // right node key
};
int main(void) {
int i, h;
struct Node a[MAX_H + 1];
scanf("%d", &h);
if (h <= MAX_H)
for (i = 1; i < h + 1; i++) {
s... | #include <stdio.h>
#define MAX_H 250
struct Node {
int id; // node id
int k; // node key
int pk; // parent node key
int lk; // left node key
int rk; // right node key
};
int main(void) {
int i, h;
struct Node a[MAX_H + 1];
scanf("%d", &h);
if (h <= MAX_H)
for (i = 1; i < h + 1; i++) {
s... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 313 | 2 |
#include <stdio.h>
#include <stdlib.h>
int main() {
int *a;
int n, i, j;
scanf("%d", &n);
a = malloc(sizeof(int) * (n + 1));
for (i = 1; i < n + 1; i++) {
scanf("%d", &a[i]);
}
for (j = 1; j < n + 1; j++) {
printf("node %d: key = %d,", j, a[j]);
if (j != 1) {
printf(" parent key = %... | #include <stdio.h>
#include <stdlib.h>
int main() {
int *a;
int n, i, j;
scanf("%d", &n);
a = malloc(sizeof(int) * (n + 1));
for (i = 1; i < n + 1; i++) {
scanf("%d", &a[i]);
}
for (j = 1; j < n + 1; j++) {
printf("node %d: key = %d, ", j, a[j]);
if (j != 1) {
printf("parent key = %... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 197 | 4 |
#include <stdio.h>
#define H 250
int main(void) {
int i, size;
int A[H];
scanf("%d", &size);
for (i = 1; i < size + 1; i++)
scanf("%d", &A[i]);
for (i = 1; i < size + 1; i++) {
printf("node %d: key = %d,", i, A[i]);
if (i != 1)
printf("parent key = %d,", A[i / 2]);
if (2 * i <= size)... | #include <stdio.h>
#define H 250
int main(void) {
int i, size;
int A[H];
scanf("%d", &size);
for (i = 1; i < size + 1; i++)
scanf("%d", &A[i]);
for (i = 1; i < size + 1; i++) {
printf("node %d: key = %d, ", i, A[i]);
if (i != 1)
printf("parent key = %d, ", A[i / 2]);
if (2 * i <= siz... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 170 | 8 |
#include <stdio.h>
#define H 250
int parent(int);
int left(int);
int right(int);
main() {
int i, n, A[H + 1], l, r;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, A[i]);
if (i >= 1) {
if (i != 1)
pr... | #include <stdio.h>
#define H 250
int parent(int);
int left(int);
int right(int);
main() {
int i, n, A[H + 1], l, r;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, A[i]);
if (i >= 1) {
if (i != 1)
pr... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 246 | 2 |
#include <stdio.h>
#define MAX 100000
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main(void) {
int n, i, A[MAX + 1];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: ... | #include <stdio.h>
#define MAX 100000
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main(void) {
int n, i, A[MAX + 1];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: ... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 221 | 1 |
#include <stdio.h>
#define max 25
int main() {
int i, h[max], n;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &h[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d,", i, h[i]);
if (i / 2 != 0) {
printf("parent key = %d,", h[i / 2]);
}
if (2 * i <= n) {
... | #include <stdio.h>
#define max 250
int main() {
int i, h[max], n;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &h[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %d, ", i, h[i]);
if (i / 2 != 0) {
printf("parent key = %d, ", h[i / 2]);
}
if (2 * i <= n) {
... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 177 | 11 |
#include <stdio.h>
#define N 250
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
main() {
int i, n, H[N];
scanf("%d", &n);
for (i = 1; i < n + 1; i++) {
scanf("%d", &H[i]);
}
for (i = 1; i < n + 1; i++) {
printf("node %d: key = %d,", ... | #include <stdio.h>
#define N 250
int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
main() {
int i, n, H[N];
scanf("%d", &n);
for (i = 1; i < n + 1; i++) {
scanf("%d", &H[i]);
}
for (i = 1; i < n + 1; i++) {
printf("node %d: key = %d, ",... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 215 | 2 |
#include <stdio.h>
#define N 500
int main(void) {
int A[N], num, i = 0;
scanf("%d", &num);
for (i = 1; i <= num; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= num; i++) {
printf("node %d: key = %d, ", i, A[i]);
if (i != 1)
printf("parent key = %d, ", A[i / 2]);
else if (i * 2 <= num)
... | #include <stdio.h>
#define N 500
int main(void) {
int A[N], num, i = 0;
scanf("%d", &num);
for (i = 1; i <= num; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= num; i++) {
printf("node %d: key = %d, ", i, A[i]);
if (i != 1)
printf("parent key = %d, ", A[i / 2]);
if (i * 2 <= num)
... | [["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["-", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]] | 0 | 171 | 2 |
#include <stdio.h>
int p(int i) { return i / 2; }
int l(int i) { return 2 * i; }
int r(int i) { return 2 * i + 1; }
int main() {
int h[512], size, n, i;
scanf("%d", &size);
for (i = 1; i <= size; ++i) {
scanf("%d", h + i);
}
for (i = 1; i <= size; ++i) {
printf("node %d: key = %d, ", i, h[i]);
... | #include <stdio.h>
int p(int i) { return i / 2; }
int l(int i) { return 2 * i; }
int r(int i) { return 2 * i + 1; }
int main() {
int h[512], size, n, i;
scanf("%d", &size);
for (i = 1; i <= size; ++i) {
scanf("%d", h + i);
}
for (i = 1; i <= size; ++i) {
printf("node %d: key = %d, ", i, h[i]);
... | [["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 205 | 6 |
#include <stdio.h>
#include <stdlib.h>
int array[251];
int main() {
int H, i, *array;
scanf("%d", &H);
for (i = 0; i < H; i++) {
scanf("%d", &array[i]);
}
for (i = 0; i < H; i++) {
printf("node %d:", i + 1);
printf(" key = %d,", array[i]);
if ((i - 1) >= 0)
printf(" parent key = %d,... | #include <stdio.h>
#include <stdlib.h>
int array[251];
int main() {
int H, i;
scanf("%d", &H);
for (i = 0; i < H; i++) {
scanf("%d", &array[i]);
}
for (i = 0; i < H; i++) {
printf("node %d:", i + 1);
printf(" key = %d,", array[i]);
if ((i - 1) >= 0)
printf(" parent key = %d,", array... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 14, 8, 9, 0, 43, 49, 84, 0, 48], ["-", 0, 14, 8, 9, 0, 43, 49, 84, 49, 22]] | 0 | 191 | 3 |
#include <stdio.h>
int T[255];
int main() {
int i, j, N;
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%d", &T[i]);
}
for (i = 0; i < N; i++) {
printf("node %d: key = %d, ", i + 1, T[i]);
if ((i - 1) / 2 > 0.0) {
printf("parent key = %d, ", T[(i - 1) / 2]);
}
if ((i + 1) * 2 -... | #include <stdio.h>
int T[255];
int main() {
int i, j, N;
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%d", &T[i]);
}
for (i = 0; i < N; i++) {
printf("node %d: key = %d, ", i + 1, T[i]);
if ((i - 1) / 2 >= 0.0 && i != 0) {
printf("parent key = %d, ", T[(i - 1) / 2]);
}
if ((i... | [["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 98], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13]] | 0 | 199 | 6 |
#include <stdio.h>
int main(void) {
int heaps[251], H, i;
scanf("%d", &H);
for (i = 1; i <= H; i++)
scanf("%d", &heaps[i]);
for (i = 1; i <= H; i++) {
printf("node %d: key = %d, ", i, heaps[i]);
if (i != 1)
printf("parent key = %d, ", heaps[i / 2]);
if (i * 2 <= H)
printf("left key %... | #include <stdio.h>
int main(void) {
int heaps[251], H, i;
scanf("%d", &H);
for (i = 1; i <= H; i++)
scanf("%d", &heaps[i]);
for (i = 1; i <= H; i++) {
printf("node %d: key = %d, ", i, heaps[i]);
if (i != 1)
printf("parent key = %d, ", heaps[i / 2]);
if (i * 2 <= H)
printf("left key =... | [["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 162 | 4 |
#include <stdio.h>
#define MAX 250
int left(int);
int right(int);
int parent(int);
int A[MAX + 1];
int main() {
int i, H;
scanf("%d", &H);
for (i = 1; i <= H; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= H; i++) {
printf("node %d: key = %d, ", i + 1, A[i]);
if (parent(i) >= 1)
printf("pare... | #include <stdio.h>
#define MAX 250
int left(int);
int right(int);
int parent(int);
int A[MAX + 1];
int main() {
int i, H;
scanf("%d", &H);
for (i = 1; i <= H; i++) {
scanf("%d", &A[i]);
}
for (i = 1; i <= H; i++) {
printf("node %d: key = %d, ", i, A[i]);
if (parent(i) >= 1)
printf("parent k... | [["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 0 | 234 | 2 |
#include <stdio.h>
int main() {
int n, i;
long long A[251];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%lld", &A[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key= %lld, ", i, A[i]);
if (i / 2 > 0)
printf("parent key = %lld, ", A[i / 2]);
if (2 * i + 1 > 0 && 2 * i <= ... | #include <stdio.h>
int main() {
int n, i;
long long A[251];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%lld", &A[i]);
}
for (i = 1; i <= n; i++) {
printf("node %d: key = %lld, ", i, A[i]);
if (i / 2 > 0)
printf("parent key = %lld, ", A[i / 2]);
if (2 * i + 1 > 0 && 2 * i <=... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 184 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.