problem_id stringlengths 6 6 | language stringclasses 2
values | original_status stringclasses 3
values | original_src stringlengths 19 243k | changed_src stringlengths 19 243k | change stringclasses 3
values | i1 int64 0 8.44k | i2 int64 0 8.44k | j1 int64 0 8.44k | j2 int64 0 8.44k | error stringclasses 270
values | stderr stringlengths 0 226k |
|---|---|---|---|---|---|---|---|---|---|---|---|
p02275 | C++ | Runtime Error | #include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int arr[1000100], c[100001], ans[1000100];
int main() {
int i, n;
scanf("%d", &n);
memset(c, 0, sizeof(c));
for (i = 1; i <= n; ++i) {
scanf("%d", &arr[i]);
++c[arr[i]];
}
for (i = 1; i < 100001; ++i)... | #include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int arr[2000100], c[100001], ans[2000100];
int main() {
int i, n;
scanf("%d", &n);
memset(c, 0, sizeof(c));
for (i = 1; i <= n; ++i) {
scanf("%d", &arr[i]);
++c[arr[i]];
}
for (i = 1; i < 100001; ++i)... | replace | 6 | 7 | 6 | 7 | 0 | |
p02275 | C++ | Runtime Error | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#define MAX 2000001
#define VMAX 10000
int main() {
unsigned short *A, *B;
int C[VMAX + 1];
int n, i, j;
scanf("%d", &n);
A = (unsigned short *)malloc(MAX);
B = (unsigned short *)malloc(MAX);
for (i = 0; i <= VMAX; i++)
... | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#define MAX 2000001
#define VMAX 10000
int main() {
unsigned short *A, *B;
int C[VMAX + 1];
int n, i, j;
scanf("%d", &n);
A = (unsigned short *)malloc(sizeof(short) * n + 1);
B = (unsigned short *)malloc(sizeof(short) * n + 1... | replace | 14 | 16 | 14 | 16 | 0 | |
p02275 | C++ | Runtime Error | #include <iostream>
#include <stdio.h>
#define MAX 2000001
#define vMAX 10000
int main() {
int n;
int C[vMAX];
for (int i = 0; i < vMAX; i++)
C[i] = 0;
scanf("%d", &n);
int *A = new int[n];
int *B = new int[n];
for (int i = 1; i <= n; i++) {
scanf("%d", &A[i]);
C[A[i]] += 1;
}
for (in... | #include <iostream>
#include <stdio.h>
#define MAX 2000001
#define vMAX 10000
int main() {
int n;
int C[vMAX];
for (int i = 0; i < vMAX; i++)
C[i] = 0;
scanf("%d", &n);
int *A = new int[n + 1];
int *B = new int[n + 1];
for (int i = 1; i <= n; i++) {
scanf("%d", &A[i]);
C[A[i]] += 1;
}
... | replace | 13 | 15 | 13 | 15 | 0 | |
p02275 | C++ | Runtime Error | #include <iostream>
using namespace std;
#define MAX_LEN 200001
#define MAX_VAL 10001
void countingSort(int n, int A[], int B[], int C[]) {
int i;
for (i = 0; i < MAX_VAL; i++) {
C[i] = 0;
}
for (i = 0; i < n; i++) {
C[A[i]]++;
}
int idx = 0;
for (i = 0; i < MAX_VAL; i++) {
if (C[i] == 0)
... | #include <iostream>
using namespace std;
#define MAX_LEN 2000000
#define MAX_VAL 10000
void countingSort(int n, int A[], int B[], int C[]) {
int i;
for (i = 0; i < MAX_VAL; i++) {
C[i] = 0;
}
for (i = 0; i < n; i++) {
C[A[i]]++;
}
int idx = 0;
for (i = 0; i < MAX_VAL; i++) {
if (C[i] == 0)
... | replace | 3 | 5 | 3 | 5 | 0 | |
p02275 | C++ | Runtime Error | #include <cmath>
#include <iostream>
#include <stdio.h>
using namespace std;
#define MAX 500000;
#define SENTINEL 2000000000;
// int count=0;
void merge(int A[], int left, int mid, int right) {
int n1 = mid - left;
int n2 = right - mid;
int L[500000 / 2 + 2], R[500000 / 2 + 2];
for (int i = 0; i < n1; i++)
... | #include <cmath>
#include <iostream>
#include <stdio.h>
using namespace std;
#define MAX 500000;
#define SENTINEL 2000000000;
// int count=0;
void merge(int A[], int left, int mid, int right) {
int n1 = mid - left;
int n2 = right - mid;
int L[500000 / 2 + 2], R[500000 / 2 + 2];
for (int i = 0; i < n1; i++)
... | replace | 77 | 79 | 77 | 79 | 0 | |
p02275 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <iostream>
#define N 10001
using namespace std;
void Counting_Sort(int *A, int n, int *B, int k) {
int *C = new int[N];
for (int i = 0; i <= k; i++)
C[i] = 0;
for (int j = 0; j < n; j++)
C[A[j]] = C[A[j]] + 1;
for (int i = 1; i <= k; i++)
C[i] = C[i] ... | #include <algorithm>
#include <cstdio>
#include <iostream>
#define N 10001
using namespace std;
void Counting_Sort(int *A, int n, int *B, int k) {
int *C = new int[N];
for (int i = 0; i <= k; i++)
C[i] = 0;
for (int j = 0; j < n; j++)
C[A[j]] = C[A[j]] + 1;
for (int i = 1; i <= k; i++)
C[i] = C[i] ... | replace | 25 | 26 | 25 | 26 | 0 | |
p02275 | C++ | Runtime Error | #include <stdio.h>
#define N 20001
int n;
void Counting_Sort(int a[], int b[], int k) {
int i, j, c[N];
for (i = 0; i <= k; i++)
c[i] = 0;
for (j = 1; j <= n; j++)
c[a[j]]++;
for (i = 1; i <= k; i++)
c[i] += c[i - 1];
for (j = n; j > 0; j--) {
b[c[a[j]]] = a[j];
c[a[j]]--;
}
for... | #include <stdio.h>
#define N 2000001
int n;
void Counting_Sort(int a[], int b[], int k) {
int i, j, c[N];
for (i = 0; i <= k; i++)
c[i] = 0;
for (j = 1; j <= n; j++)
c[a[j]]++;
for (i = 1; i <= k; i++)
c[i] += c[i - 1];
for (j = n; j > 0; j--) {
b[c[a[j]]] = a[j];
c[a[j]]--;
}
f... | replace | 2 | 3 | 2 | 3 | 0 | |
p02275 | C++ | Runtime Error | #include <iostream>
using namespace std;
int A[200000];
int B[200000];
int C[10001];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> A[i];
C[A[i]]++;
}
for (int i = 1; i <= 10000; i++) {
C[i] += C[i - 1];
}
for (int j = n - 1; j >= 0; j--) {
B[--C[A[j]]] = A[j];
... | #include <iostream>
using namespace std;
int A[2000000];
int B[2000000];
int C[10001];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> A[i];
C[A[i]]++;
}
for (int i = 1; i <= 10000; i++) {
C[i] += C[i - 1];
}
for (int j = n - 1; j >= 0; j--) {
B[--C[A[j]]] = A[j];
... | replace | 4 | 6 | 4 | 6 | 0 | |
p02275 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
int b[200005];
signed main() {
int a;
scanf("%d", &a);
for (int c = 0; c < a; c++) {
scanf("%d", &b[c]);
}
sor... | #include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
int b[2000005];
signed main() {
int a;
scanf("%d", &a);
for (int c = 0; c < a; c++) {
scanf("%d", &b[c]);
}
so... | replace | 11 | 12 | 11 | 12 | 0 | |
p02275 | C++ | Runtime Error | #include <array>
#include <iostream>
#include <string>
using namespace std;
int n;
array<short, 2000001> A;
array<short, 2000001> B;
array<short, 10001> C;
void CountingSort(int k) {
for (int j = 0; j < n; j++) {
C[A[j]]++;
}
for (int i = 1; i <= k; i++) {
C[i] = C[i] + C[i - 1];
}
for (int j = n ... | #include <array>
#include <iostream>
#include <string>
using namespace std;
int n;
array<short, 2000001> A;
array<short, 2000001> B;
array<int, 10001> C;
void CountingSort(int k) {
for (int j = 0; j < n; j++) {
C[A[j]]++;
}
for (int i = 1; i <= k; i++) {
C[i] = C[i] + C[i - 1];
}
for (int j = n - ... | replace | 9 | 10 | 9 | 10 | 0 | |
p02275 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
const int MAX_N = 200000;
int main() {
int n, A[MAX_N] = {0}, B[MAX_N] = {0}, C[10000] = {0}, max;
scanf("%d", &n);
max = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &A[i]);
if (max < A[i]) {
m... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
const int MAX_N = 2000000;
int main() {
int n, A[MAX_N] = {0}, B[MAX_N] = {0}, C[10000] = {0}, max;
scanf("%d", &n);
max = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &A[i]);
if (max < A[i]) {
... | replace | 7 | 8 | 7 | 8 | 0 | |
p02275 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
void counting_sort(vector<int> &A, int n) {
int k = *max_element(A.begin(), A.end());
vector<int> B(n);
vector<int> C(k + 1);
for (int i = 0; i < k; i++)
C[i] = 0;
for (int j = 0; j < n; j++)
C[A[j]]++;
for (int i = ... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
void counting_sort(vector<int> &A, int n) {
int k = *max_element(A.begin(), A.end());
vector<int> B(n + 1);
vector<int> C(k + 1);
for (int i = 0; i < k; i++)
C[i] = 0;
for (int j = 0; j < n; j++)
C[A[j]]++;
for (int ... | replace | 9 | 10 | 9 | 10 | 0 | |
p02275 | C++ | Runtime Error | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
int main() {
int n, i, max;
scanf("%d", &n);
int A[n + 1];
int B[n + 1];
max = (1 << 30) * -1;
for (i = 0; i < n; i++) {
scanf("%hu", &A[i + 1]);
max = MAX(max, A[i + 1]);
}
int C[max + 1];... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
int main() {
int n, i, max;
scanf("%d", &n);
unsigned short A[n + 1];
unsigned short B[n + 1];
max = (1 << 30) * -1;
for (i = 0; i < n; i++) {
scanf("%hu", &A[i + 1]);
max = MAX(max, A[i + 1]);... | replace | 10 | 12 | 10 | 12 | -11 | |
p02275 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ctype.h>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#includ... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ctype.h>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#includ... | replace | 32 | 33 | 32 | 33 | 0 | |
p02275 | C++ | Runtime Error | #include <stdio.h>
#define N 10000
int A[200000], C[N], B[200000];
int main() {
int i, n;
scanf("%d", &n);
for (i = 1; i < n + 1; i++) {
scanf("%d", &A[i]);
}
for (i = 0; i < N; i++) {
C[i] = 0;
}
for (i = 1; i < n + 1; i++) {
C[A[i]] += 1;
}
for (i = 0; i < N; i++) {
C[i] += C[i - 1... | #include <stdio.h>
#define N 10000
int A[2000001], C[N], B[2000001];
int main() {
int i, n;
scanf("%d", &n);
for (i = 1; i < n + 1; i++) {
scanf("%d", &A[i]);
}
for (i = 0; i < N; i++) {
C[i] = 0;
}
for (i = 1; i < n + 1; i++) {
C[A[i]] += 1;
}
for (i = 0; i < N; i++) {
C[i] += C[i -... | replace | 2 | 3 | 2 | 3 | 0 | |
p02275 | C++ | Runtime Error | #include <stdio.h>
#define N 10000
int A[10000], C[N], B[2000001];
int main() {
int i, n;
scanf("%d", &n);
for (i = 1; i < n + 1; i++) {
scanf("%d", &A[i]);
}
for (i = 0; i < N; i++) {
C[i] = 0;
}
for (i = 1; i < n + 1; i++) {
C[A[i]] += 1;
}
for (i = 0; i < N; i++) {
C[i] += C[i - 1... | #include <stdio.h>
#define N 10000
int A[2000001], C[N], B[2000001];
int main() {
int i, n;
scanf("%d", &n);
for (i = 1; i < n + 1; i++) {
scanf("%d", &A[i]);
}
for (i = 0; i < N; i++) {
C[i] = 0;
}
for (i = 1; i < n + 1; i++) {
C[A[i]] += 1;
}
for (i = 0; i < N; i++) {
C[i] += C[i -... | replace | 2 | 3 | 2 | 3 | 0 | |
p02275 | C++ | Runtime Error | #include <stdio.h>
int main() {
int n;
scanf("%d", &n);
int A[n + 1], B[n + 1], C[10000 + 1];
for (int i = 0; i < 10000 + 1; i++) {
C[i] = 0;
}
for (int i = 0; i < n; i++) {
scanf("%d", &A[i + 1]);
C[A[i + 1]]++;
}
for (int i = 0; i < 10000 + 1; i++)
C[i + 1] = C[i + 1] + C[i];
fo... | #include <stdio.h>
int main() {
int n;
scanf("%d", &n);
int A[n + 1], B[n + 1], C[10000 + 1];
for (int i = 0; i < 10000 + 1; i++) {
C[i] = 0;
}
for (int i = 0; i < n; i++) {
scanf("%d", &A[i + 1]);
C[A[i + 1]]++;
}
for (int i = 0; i < 10000 + 1; i++)
C[i + 1] = C[i + 1] + C[i];
fo... | replace | 21 | 22 | 21 | 22 | 0 | |
p02275 | C++ | Runtime Error | #include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
const int MAX = 10010;
void countingSort(std::vector<int> &A, std::vector<int> &sorted) {
int count[MAX];
int n = A.size();
memset(count, 0, sizeof(count));
for (int i = 0; i < n; i++)
count[A[i]]++;
for (int i = 0; i < MAX; i++... | #include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
const int MAX = 10010;
void countingSort(std::vector<int> &A, std::vector<int> &sorted) {
int count[MAX];
int n = A.size();
memset(count, 0, sizeof(count));
for (int i = 0; i < n; i++)
count[A[i]]++;
for (int i = 0; i < MAX; i++... | replace | 15 | 16 | 15 | 16 | -11 | |
p02275 | C++ | Runtime Error | #include <algorithm> // next_permutation
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric> //accumulate
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
// #include <unordered_map> //???????????\??¢??°
#include <fstream> ... | #include <algorithm> // next_permutation
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric> //accumulate
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
// #include <unordered_map> //???????????\??¢??°
#include <fstream> ... | replace | 69 | 70 | 69 | 70 | 0 | |
p02275 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
static void inputArray(int A[], int num) {
for (int i = 0; i < num; i++) {
cin >> A[i];
}
}
static void printArray(int A[], int num) {
for (int i = 0; i < num; i++) {
cout << ((i != 0) ? " " : "") << A[i];
}
cout << endl;
}
static vector<i... | #include <iostream>
#include <vector>
using namespace std;
static void inputArray(int A[], int num) {
for (int i = 0; i < num; i++) {
cin >> A[i];
}
}
static void printArray(int A[], int num) {
for (int i = 0; i < num; i++) {
cout << ((i != 0) ? " " : "") << A[i];
}
cout << endl;
}
static vector<i... | replace | 33 | 34 | 33 | 34 | 0 | |
p02275 | C++ | Runtime Error | #include <stdio.h>
#define N 10000
int A[200000], C[N], B[2000001];
int main() {
int i, n;
scanf("%d", &n);
for (i = 1; i < n + 1; i++) {
scanf("%d", &A[i]);
}
for (i = 0; i < N; i++) {
C[i] = 0;
}
for (i = 1; i < n + 1; i++) {
C[A[i]] += 1;
}
for (i = 0; i < N; i++) {
C[i] += C[i - ... | #include <stdio.h>
#define N 10000
int A[2000001], C[N], B[2000001];
int main() {
int i, n;
scanf("%d", &n);
for (i = 1; i < n + 1; i++) {
scanf("%d", &A[i]);
}
for (i = 0; i < N; i++) {
C[i] = 0;
}
for (i = 1; i < n + 1; i++) {
C[A[i]] += 1;
}
for (i = 0; i < N; i++) {
C[i] += C[i -... | replace | 2 | 3 | 2 | 3 | 0 | |
p02275 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <string>
using namespace std;
const int num = 20001, num1 = 10000;
int main() {
int n, a[num], c[num1 + 1], b[num];
cin >> n;
for (int i = 0; i <= num1; i++)
c[i] = 0;
for (int i = 0; i < n; i++)
cin >> a... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <string>
using namespace std;
const int num = 2000001, num1 = 10000;
int main() {
int n, a[num], c[num1 + 1], b[num];
cin >> n;
for (int i = 0; i <= num1; i++)
c[i] = 0;
for (int i = 0; i < n; i++)
cin >>... | replace | 7 | 8 | 7 | 8 | 0 | |
p02275 | C++ | Time Limit Exceeded | #include "string.h"
#include <algorithm>
#include <iostream>
#include <limits>
#include <math.h>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using intll_t = long long;
int main() {
... | #include "string.h"
#include <algorithm>
#include <iostream>
#include <limits>
#include <math.h>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using intll_t = long long;
int main() {
... | insert | 45 | 45 | 45 | 46 | TLE | |
p02275 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
static void inputArray(int A[], int num) {
for (int i = 0; i < num; i++) {
cin >> A[i];
}
}
static void printArray(int A[], int num) {
for (int i = 0; i < num; i++) {
cout << ((i != 0) ? " " : "") << A[i];
}
cout << endl;
}
static vector<i... | #include <iostream>
#include <vector>
using namespace std;
static void inputArray(int A[], int num) {
for (int i = 0; i < num; i++) {
cin >> A[i];
}
}
static void printArray(int A[], int num) {
for (int i = 0; i < num; i++) {
cout << ((i != 0) ? " " : "") << A[i];
}
cout << endl;
}
static vector<i... | replace | 33 | 34 | 33 | 34 | 0 | |
p02276 | C++ | Runtime Error | #include <stdio.h>
#define N 10000
int partition(int, int);
int A[N];
int main() {
int i, n, q;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &A[i]);
}
q = partition(0, n - 1);
for (i = 0; i < n; i++) {
if (i != 0)
printf(" ");
if (i == q)
printf("[");
printf("%d", A[i... | #include <stdio.h>
#define N 100000
int partition(int, int);
int A[N];
int main() {
int i, n, q;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &A[i]);
}
q = partition(0, n - 1);
for (i = 0; i < n; i++) {
if (i != 0)
printf(" ");
if (i == q)
printf("[");
printf("%d", A[... | replace | 1 | 2 | 1 | 2 | 0 | |
p02276 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
int n;
int partition(int A[], int p, int r) {
int x = A[r];
int i = p - 1;
for (int j = p; j < r; j++) {
cerr << "j:" << j << endl;
if (A[j] <= x) {
i++;
swap(A[i], A[j]);
}
}
swap(A[i + 1], A[r]);
return i + 1;
}
int main()... | #include <iostream>
#include <vector>
using namespace std;
int n;
int partition(int A[], int p, int r) {
int x = A[r];
int i = p - 1;
for (int j = p; j < r; j++) {
if (A[j] <= x) {
i++;
swap(A[i], A[j]);
}
}
swap(A[i + 1], A[r]);
return i + 1;
}
int main() {
for (; cin >> n;) {
in... | delete | 9 | 10 | 9 | 9 | 0 | j:0
j:1
j:2
j:3
j:4
j:5
j:6
j:7
j:8
j:9
j:10
|
p02276 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
using namespace std;
int n[100003] = {};
int main() {
int N;
cin >> N;
for (int i = 0; i < N; i++)
cin >> n[i];
int x = 0, y = 0;
while (x < N && y < N) {
if (n[x] < n[N - 1]) {
x++;
y = x + ... | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
using namespace std;
int n[100003] = {};
int main() {
int N;
cin >> N;
for (int i = 0; i < N; i++)
cin >> n[i];
int x = 0, y = 0;
while (x < N && y < N) {
if (n[x] <= n[N - 1]) {
x++;
y = x ... | replace | 17 | 18 | 17 | 19 | TLE | |
p02276 | C++ | Runtime Error | #include <stdio.h>
int main() {
int i, a, A[50000], z, jsta = 0, jend = 0, B[50000], j;
scanf("%d", &a);
for (i = 0; i < a; i++) {
scanf("%d", &A[i]);
}
for (i = 0; i < a; i++) {
if (A[i] <= A[a - 1]) {
z = A[jsta];
A[jsta] = A[i];
A[i] = z;
jsta++;
jend++;
} else
... | #include <stdio.h>
int main() {
int i, a, A[100000], z, jsta = 0, jend = 0, B[100000], j;
scanf("%d", &a);
for (i = 0; i < a; i++) {
scanf("%d", &A[i]);
}
for (i = 0; i < a; i++) {
if (A[i] <= A[a - 1]) {
z = A[jsta];
A[jsta] = A[i];
A[i] = z;
jsta++;
jend++;
} else
... | replace | 2 | 3 | 2 | 3 | 0 | |
p02276 | C++ | Runtime Error | #include <iostream>
using namespace std;
// Exchange
void exchange(int A[], int i, int j) {
int tmp = A[i];
A[i] = A[j];
A[j] = tmp;
}
// Partition
int partition(int A[], int l, int r) {
int threshold = A[r - 1];
int i = l - 1;
for (int j = l; j < r - 1; j++) {
if (A[j] <= threshold) {
i++;
... | #include <iostream>
using namespace std;
// Exchange
void exchange(int A[], int i, int j) {
int tmp = A[i];
A[i] = A[j];
A[j] = tmp;
}
// Partition
int partition(int A[], int l, int r) {
int threshold = A[r - 1];
int i = l - 1;
for (int j = l; j < r - 1; j++) {
if (A[j] <= threshold) {
i++;
... | replace | 31 | 32 | 31 | 32 | 0 | |
p02276 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int *A = new int[n + 1];
for (int i = 1; i < n + 1; i++) {
cin >> A[i];
}
int x = A[n];
int i = 0;
int tmp = 0;
for (int j = 1; j <= n - 1; j++) {
if (A[j] <= x) {
i = i + 1;
tmp = A[i];
A[i] = A[j];
... | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int *A = new int[n + 1];
for (int i = 1; i < n + 1; i++) {
cin >> A[i];
}
int x = A[n];
int i = 0;
int tmp = 0;
for (int j = 1; j <= n - 1; j++) {
if (A[j] <= x) {
i = i + 1;
tmp = A[i];
A[i] = A[j];
... | replace | 33 | 34 | 33 | 34 | TLE | |
p02276 | C++ | Runtime Error | #include <cstdlib>
#include <iostream>
#include <list>
#include <stack>
#include <string>
using namespace std;
int main() {
int n, s[10000], small = 0, large = 0, cnt = 0;
cin >> n;
bool b = true;
for (int i = 0; i < n; i++) {
cin >> s[i];
}
for (int i = 0; i < n; i++) {
if (s[i] <= s[n - 1]) {
... | #include <cstdlib>
#include <iostream>
#include <list>
#include <stack>
#include <string>
using namespace std;
int main() {
int n, s[100000], small = 0, large = 0, cnt = 0;
cin >> n;
bool b = true;
for (int i = 0; i < n; i++) {
cin >> s[i];
}
for (int i = 0; i < n; i++) {
if (s[i] <= s[n - 1]) {
... | replace | 7 | 8 | 7 | 8 | 0 | |
p02277 | C++ | Runtime Error | #include <iostream>
using namespace std;
struct Card {
char suit;
int value;
};
struct Card L[100000 / 2 + 2], R[100000 / 2 + 2];
void merge(struct Card A[], int n, int left, int mid, int right) {
int i, j;
int n1 = mid - left;
int n2 = right - mid;
for (i = 0; i < n1; i++)
L[i] = A[left + i];
for ... | #include <iostream>
using namespace std;
struct Card {
char suit;
int value;
};
struct Card L[100000 / 2 + 2], R[100000 / 2 + 2];
void merge(struct Card A[], int n, int left, int mid, int right) {
int i, j;
int n1 = mid - left;
int n2 = right - mid;
for (i = 0; i < n1; i++)
L[i] = A[left + i];
for ... | replace | 65 | 66 | 65 | 66 | 0 | |
p02277 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <set>
#include <vector>
using namespace std;
#define NMAX 10000
#define SENTINEL 1000000001
int Partition(int A[], char B[], int p, int r) {
int x = A[r];
int i = p - 1;
for (int j = p; j <= r - 1; j++) {
if (A[j] <= x) {
i++;
swap(A[i], A[j]);
... | #include <algorithm>
#include <iostream>
#include <set>
#include <vector>
using namespace std;
#define NMAX 100000
#define SENTINEL 1000000001
int Partition(int A[], char B[], int p, int r) {
int x = A[r];
int i = p - 1;
for (int j = p; j <= r - 1; j++) {
if (A[j] <= x) {
i++;
swap(A[i], A[j]);... | replace | 7 | 8 | 7 | 8 | 0 | |
p02277 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
const int INF = (1 << 30);
const int N = 100005;
struct Card {
char suit;
int value;
} card[N], t[N], temp;
Card L[N / 2 + 1], R[N / 2 + 1];
void _merge(Card a[], int l, int m, int r) //[l, r)
{
int i, j, k;
int n1 = m - l;
int n... | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
const int INF = (1 << 30);
const int N = 100005;
struct Card {
char suit;
int value;
} card[N], t[N], temp;
Card L[N / 2 + 1], R[N / 2 + 1];
void _merge(Card a[], int l, int m, int r) //[l, r)
{
int i, j, k;
int n1 = m - l;
int n... | replace | 34 | 35 | 34 | 35 | -11 | |
p02277 | C++ | Time Limit Exceeded | #include <cstdio>
#include <iostream>
using namespace std;
#define MAX 100000
#define SENTINEL 2000000000
struct Card {
char suit;
int value;
};
struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];
void merge(struct Card A[], int left, int mid, int right) {
int i, j, k;
int n1 = mid - left;
int n2 = right - mid;
... | #include <cstdio>
#include <iostream>
using namespace std;
#define MAX 100000
#define SENTINEL 2000000000
struct Card {
char suit;
int value;
};
struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];
void merge(struct Card A[], int left, int mid, int right) {
int i, j, k;
int n1 = mid - left;
int n2 = right - mid;
... | delete | 95 | 105 | 95 | 95 | TLE | |
p02277 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <v... | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <v... | replace | 49 | 50 | 49 | 51 | 0 | |
p02277 | C++ | Runtime Error | #include <cstdio>
#include <iostream>
using namespace std;
struct Card {
char mark;
int value;
};
int merge(struct Card A[], int left, int mid, int right) {
int n1 = mid - left;
int n2 = right - mid;
int i, j, k;
struct Card L[25001];
struct Card R[25001];
for (i = 0; i <= n1 - 1; i++)
L[i] = A[l... | #include <cstdio>
#include <iostream>
using namespace std;
struct Card {
char mark;
int value;
};
int merge(struct Card A[], int left, int mid, int right) {
int n1 = mid - left;
int n2 = right - mid;
int i, j, k;
struct Card L[50001];
struct Card R[50001];
for (i = 0; i <= n1 - 1; i++)
L[i] = A[l... | replace | 13 | 15 | 13 | 15 | 0 | |
p02277 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define AMAX 100001
struct card {
char mark;
int value;
int cnt;
};
card a[AMAX];
int partion(int q, int r) {
int x = a[r].value;
int i = q - 1;
for (int j = q; j < r; j++) {
if (a[j].value <= x) {
i = i + 1;
swap(a[i], a[j]);
}
}
swap... | #include <bits/stdc++.h>
using namespace std;
#define AMAX 100001
struct card {
char mark;
int value;
int cnt;
};
card a[AMAX];
int partion(int q, int r) {
int x = a[r].value;
int i = q - 1;
for (int j = q; j < r; j++) {
if (a[j].value <= x) {
i = i + 1;
swap(a[i], a[j]);
}
}
swap... | replace | 29 | 30 | 29 | 30 | TLE | |
p02277 | C++ | Time Limit Exceeded | #include <iostream>
#include <utility>
#include <vector>
int Partition(std::vector<std::pair<char, int>> &v, int p, int r) {
int x = v[r].second;
int i = p - 1;
for (int j = p; j < r; ++j) {
if (v[j].second <= x) {
v[++i].swap(v[j]);
}
}
v[i + 1].swap(v[r]);
return i + 1;
}
void QuickSort(st... | #include <iostream>
#include <utility>
#include <vector>
int Partition(std::vector<std::pair<char, int>> &v, int p, int r) {
int x = v[r].second;
int i = p - 1;
for (int j = p; j < r; ++j) {
if (v[j].second <= x) {
v[++i].swap(v[j]);
}
}
v[i + 1].swap(v[r]);
return i + 1;
}
void QuickSort(st... | replace | 73 | 76 | 73 | 78 | TLE | |
p02277 | C++ | Runtime Error | // クイックソート
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
// #define MAX_N 100000
#define MAX_N 100
// const int INFTY = 2147483647;
typedef struct card {
char picture;
int number;
} CARD;
... | // クイックソート
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
#define MAX_N 100000
// const int INFTY = 2147483647;
typedef struct card {
char picture;
int number;
} CARD;
int partition(CARD A[... | replace | 12 | 14 | 12 | 13 | 0 | |
p02277 | C++ | Runtime Error | #define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <... | #define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <... | replace | 22 | 23 | 22 | 23 | 0 | |
p02277 | C++ | Runtime Error | #include <iostream>
#include <stdio.h>
#define SENTINEL 1000000001
struct Card {
char suit;
int value;
};
void trace(Card a[], int size) {
for (int i = 0; i < size; ++i) {
printf("%c %d\n", a[i].suit, a[i].value);
}
}
void Merge(Card A[], int left, int mid, int right) {
int n1 = mid - left;
int n2 =... | #include <iostream>
#include <stdio.h>
#define SENTINEL 1000000001
struct Card {
char suit;
int value;
};
void trace(Card a[], int size) {
for (int i = 0; i < size; ++i) {
printf("%c %d\n", a[i].suit, a[i].value);
}
}
void Merge(Card A[], int left, int mid, int right) {
int n1 = mid - left;
int n2 =... | replace | 82 | 83 | 82 | 83 | 0 | |
p02277 | C++ | Time Limit Exceeded | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 100000
#define LARGE 2000000000
typedef struct {
char suit;
int value;
} Card;
Card L[MAX / 2 + 2], R[MAX / 2 + 2];
void merge(Card *, int, int, int, int);
void mergeSort(Card *, int, int, int);
int partition(Card *, int, int, int);
void quic... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 100000
#define LARGE 2000000000
typedef struct {
char suit;
int value;
} Card;
Card L[MAX / 2 + 2], R[MAX / 2 + 2];
void merge(Card *, int, int, int, int);
void mergeSort(Card *, int, int, int);
int partition(Card *, int, int, int);
void quic... | replace | 69 | 70 | 69 | 70 | TLE | |
p02277 | C++ | Runtime Error | #include <iostream>
#define M 100000
#define S 2000000000
using namespace std;
struct card {
int num;
char d;
};
void merge(card *a, int l, int m, int r) {
card L[m / 2 + 2];
card R[m / 2 + 2];
int n1 = m - l;
int n2 = r - m;
int b = 0, c = 0;
for (int i = 0; i < n1; i++)
L[i] = a[l + i];
for ... | #include <iostream>
#define M 100000
#define S 2000000000
using namespace std;
struct card {
int num;
char d;
};
void merge(card *a, int l, int m, int r) {
card L[M / 2 + 2];
card R[M / 2 + 2];
int n1 = m - l;
int n2 = r - m;
int b = 0, c = 0;
for (int i = 0; i < n1; i++)
L[i] = a[l + i];
for ... | replace | 12 | 14 | 12 | 14 | 0 | |
p02278 | C++ | Memory Limit Exceeded | #include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
#define MAX_N 10000
#define MAX_V 65000000
#define INF 10000000000
int n, A[MAX_N], s, B[MAX_N], T[MAX_V], cur, S, m, x;
bool V[MAX_N];
int minimum_cost_sort() {
int ans = 0;
for (int i = 0; i < MAX_V; i++) {
V[i] = false;
}
... | #include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
#define MAX_N 10000
#define MAX_V 60000000
#define INF 10000000000
int n, A[MAX_N], s, B[MAX_N], T[MAX_V], cur, S, m, x;
bool V[MAX_N];
int minimum_cost_sort() {
int ans = 0;
for (int i = 0; i < MAX_V; i++) {
V[i] = false;
}
... | replace | 5 | 6 | 5 | 6 | MLE | |
p02278 | C++ | Runtime Error | //============================================================================
// Name : MinCostSort.cpp
// Author : Ken
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#in... | //============================================================================
// Name : MinCostSort.cpp
// Author : Ken
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#in... | replace | 13 | 14 | 13 | 14 | 0 | |
p02278 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int n, w[1000], s;
int a[1000], d[1001]; // destination
long solve() {
long ret = 0;
bool v[1000];
for (int i = 0; i < n; ++i) {
a[i] = w[i];
v[i] = false;
}
sort(a, a + n); // a[]??????w[]???????????¢?????\???
//???... | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int n, w[1000], s;
int a[1000], d[10001]; // destination
long solve() {
long ret = 0;
bool v[1000];
for (int i = 0; i < n; ++i) {
a[i] = w[i];
v[i] = false;
}
sort(a, a + n); // a[]??????w[]???????????¢?????\???
//??... | replace | 6 | 7 | 6 | 7 | 0 | |
p02278 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 1000;
static const int VMAX = 10000;
int n, A[MAX], s;
int B[MAX], T[VMAX + 1];
int solve() {
int ans = 0;
bool V[MAX];
for (int i = 0; i < n; i++) {
B[i] = A[i];
V[i] = false;
}
sort(B, B + n);
for (int i = 0; i... | #include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 1000;
static const int VMAX = 10000;
int n, A[MAX], s;
int B[MAX], T[VMAX + 1];
int solve() {
int ans = 0;
bool V[MAX];
for (int i = 0; i < n; i++) {
B[i] = A[i];
V[i] = false;
}
sort(B, B + n);
for (int i = 0; i... | replace | 34 | 36 | 34 | 36 | TLE | |
p02278 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define N 1005
#define INF (1 << 30)
typedef long long ll;
using namespace std;
int main() {
int weight[N];
int sorted[N]... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define N 1005
#define INF (1 << 30)
typedef long long ll;
using namespace std;
int main() {
int weight[N];
int sorted[N]... | replace | 19 | 20 | 19 | 20 | 0 | |
p02278 | C++ | Runtime Error | #include <algorithm>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <queue>
#include <sstream>
#include <stack>
#include <stdio.h>
#define MAX 100000
using namespace std;
typedef long long ll;
ll ans;
void solve(int a[], int n) {
int b[1000], t[1000], vmin, vmax = 1000;
bool vis[... | #include <algorithm>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <queue>
#include <sstream>
#include <stack>
#include <stdio.h>
#define MAX 100000
using namespace std;
typedef long long ll;
ll ans;
void solve(int a[], int n) {
int b[1000], t[10005], vmin, vmax = 10000;
bool vi... | replace | 14 | 15 | 14 | 15 | 0 | |
p02278 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int minimumCostSort(int *W, int n) {
int X[1000], R[1000];
for (int i = 0; i < n; i++) {
X[i] = W[i];
}
sort(X, X + n);
for (int i = 0; i < n; i++)
R[X[i]] = i;
int m = X[0];
int sum = 0;
for (int i = 0; i < n; i++... | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int minimumCostSort(int *W, int n) {
int X[1000], R[10001];
for (int i = 0; i < n; i++) {
X[i] = W[i];
}
sort(X, X + n);
for (int i = 0; i < n; i++)
R[X[i]] = i;
int m = X[0];
int sum = 0;
for (int i = 0; i < n; i+... | replace | 6 | 7 | 6 | 7 | 0 | |
p02278 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 200005;
int w[1005], B[1005], L[1005], flag[1005];
int main() {
int n, ans = 0, Min = INF;
cin >> n;
for (int i = 0; i < n; i++) {
... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 200005;
int w[1005], B[1005], L[100005], flag[1005];
int main() {
int n, ans = 0, Min = INF;
cin >> n;
for (int i = 0; i < n; i++) {... | replace | 10 | 11 | 10 | 11 | 0 | |
p02279 | C++ | Runtime Error | #include <bits/stdc++.h>
/*#include<iostream>
#include<algorithm>
#include<climits>*/
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define rep1(i, a, b) for (int i = a; i <= (b); ++i)
#define per(i, a, ... | #include <bits/stdc++.h>
/*#include<iostream>
#include<algorithm>
#include<climits>*/
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define rep1(i, a, b) for (int i = a; i <= (b); ++i)
#define per(i, a, ... | replace | 16 | 17 | 16 | 17 | 0 | |
p02279 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
struct node {
int parent, depth;
vector<int> child;
};
vector<node> tree;
void dfs(int num) {
if (tree[num].child.size() == 0)
return;
for (int i = 0; i < tree[num].child.size(); i++) {
tree[tree[num].child[i]].depth = tree[num].depth + 1;
... | #include <iostream>
#include <vector>
using namespace std;
struct node {
int parent, depth;
vector<int> child;
};
vector<node> tree;
void dfs(int num) {
if (tree[num].child.size() == 0)
return;
for (int i = 0; i < tree[num].child.size(); i++) {
tree[tree[num].child[i]].depth = tree[num].depth + 1;
... | replace | 47 | 48 | 47 | 50 | 0 | |
p02279 | C++ | Time Limit Exceeded | #include <cstdlib>
#include <iostream>
using namespace std;
#define MAX 100005
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int n, D[MAX];
void print(int u) {
cout << "node " << u << ": ";
cout << "parent = " << T[u].parent << ", ";
cout << "depth = " << D[u] << ", ";
... | #include <cstdlib>
#include <iostream>
using namespace std;
#define MAX 100005
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int n, D[MAX];
void print(int u) {
cout << "node " << u << ": ";
cout << "parent = " << T[u].parent << ", ";
cout << "depth = " << D[u] << ", ";
... | replace | 62 | 66 | 62 | 66 | TLE | |
p02279 | C++ | Time Limit Exceeded | #include <iostream>
#define NIL -1
using namespace std;
struct node {
int parent, left, right, depth;
};
struct node tree[100010];
void searchDepth(int start) {
int currentNumber = start;
int answer = 0;
while (tree[currentNumber].parent != NIL) {
currentNumber = tree[currentNumber].parent;
answer++... | #include <iostream>
#define NIL -1
using namespace std;
struct node {
int parent, left, right, depth;
};
struct node tree[100010];
void searchDepth(int start) {
int currentNumber = start;
int answer = 0;
while (tree[currentNumber].parent != NIL) {
currentNumber = tree[currentNumber].parent;
answer++... | replace | 24 | 26 | 24 | 28 | TLE | |
p02279 | C++ | Runtime Error | // 根付き木の表現
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
#define MAX_N 100
const int NIL = -1;
typedef struct v_node_num {
// 節点の親
int parent;
// 節点の左の子
int left_child;
// 節点の右の兄弟
i... | // 根付き木の表現
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
#define MAX_N 100005
const int NIL = -1;
typedef struct v_node_num {
// 節点の親
int parent;
// 節点の左の子
int left_child;
// 節点の右の兄弟
... | replace | 12 | 13 | 12 | 13 | 0 | |
p02279 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;
struct Node {
string type;
int depth;
int parent = -1;
vector<int> child;
};
int main() {
int n;
Node node[1000];
queue<Node *> q;
int depth = 0;
cin >> n;
for (int i = 0; i < n; i++... | #include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;
struct Node {
string type;
int depth;
int parent = -1;
vector<int> child;
};
int main() {
int n;
Node node[100000];
queue<Node *> q;
int depth = 0;
cin >> n;
for (int i = 0; i < n; i... | replace | 16 | 17 | 16 | 17 | 0 | |
p02279 | C++ | Runtime Error | #include <iostream>
using namespace std;
#define MAX 1000
struct Node {
int parent, left, right;
};
struct Node T[MAX];
int D[MAX];
int get_depth(int);
void setDepth(int, int);
int main() {
int n;
int n2;
int n3;
int node;
cin >> n;
for (int i = 0; i < n; i++) {
T[i].parent = T[i].left = T[i].rig... | #include <iostream>
using namespace std;
#define MAX 1000000
struct Node {
int parent, left, right;
};
struct Node T[MAX];
int D[MAX];
int get_depth(int);
void setDepth(int, int);
int main() {
int n;
int n2;
int n3;
int node;
cin >> n;
for (int i = 0; i < n; i++) {
T[i].parent = T[i].left = T[i].... | replace | 3 | 4 | 3 | 4 | 0 | |
p02279 | C++ | Runtime Error | #include <iostream>
#include <stdlib.h>
using namespace std;
struct Node {
int parent;
int number;
struct Node *left;
struct Node *right;
};
struct Node *N[10000];
// void show()
//
int getDepth(struct Node *node) {
int count = 0;
while (node->parent != -1) {
count++;
node = N[node->parent];
}... | #include <iostream>
#include <stdlib.h>
using namespace std;
struct Node {
int parent;
int number;
struct Node *left;
struct Node *right;
};
struct Node *N[100000];
// void show()
//
int getDepth(struct Node *node) {
int count = 0;
while (node->parent != -1) {
count++;
node = N[node->parent];
... | replace | 11 | 12 | 11 | 12 | 0 | |
p02279 | C++ | Runtime Error | #include <stdio.h>
#define MAX 10000
#define NIL -1
struct Node {
int p, l, r;
};
struct Node T[MAX];
int n, D[MAX], H[MAX];
void print(int u) {
int i, c;
printf("node %d: ", u);
printf("parent = %d, ", T[u].p);
printf("depth = %d, ", D[u]);
if (T[u].p == NIL)
printf("root, ");
else if (T[u].l ==... | #include <stdio.h>
#define MAX 100005
#define NIL -1
struct Node {
int p, l, r;
};
struct Node T[MAX];
int n, D[MAX], H[MAX];
void print(int u) {
int i, c;
printf("node %d: ", u);
printf("parent = %d, ", T[u].p);
printf("depth = %d, ", D[u]);
if (T[u].p == NIL)
printf("root, ");
else if (T[u].l =... | replace | 2 | 3 | 2 | 3 | 0 | |
p02279 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define N 100005
#define INF (1 << 30)
typedef long long ll;
using namespace std;
vector<int> child[N];
int parent[N];
int Ge... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define N 100005
#define INF (1 << 30)
typedef long long ll;
using namespace std;
vector<int> child[N];
int parent[N];
int Ge... | delete | 28 | 30 | 28 | 28 | -11 | |
p02279 | C++ | Runtime Error | #include <stdio.h>
#include <stdlib.h>
#define N 10000
typedef struct node {
int p;
int right;
int left;
} Node;
int main() {
int n, i, j, l, c, k, id, P, depth, r;
Node a[N], tmp;
scanf("%d", &n);
for (i = 0; i < n; i++) {
a[i].p = -1;
a[i].right = -1;
a[i].left = -1;
}
for (i = 0; ... | #include <stdio.h>
#include <stdlib.h>
#define N 1000000
typedef struct node {
int p;
int right;
int left;
} Node;
int main() {
int n, i, j, l, c, k, id, P, depth, r;
Node a[N], tmp;
scanf("%d", &n);
for (i = 0; i < n; i++) {
a[i].p = -1;
a[i].right = -1;
a[i].left = -1;
}
for (i = 0... | replace | 2 | 3 | 2 | 3 | 0 | |
p02279 | C++ | Runtime Error | #include <iostream>
#include <string>
#include <vector>
using namespace std;
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int depth(int i) {
int count = 0;
int c = i;
while (T[c].parent != NIL) {
c = T[c].parent;
count++;
}
return count;
}
string node... | #include <iostream>
#include <string>
#include <vector>
using namespace std;
#define MAX 100000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int depth(int i) {
int count = 0;
int c = i;
while (T[c].parent != NIL) {
c = T[c].parent;
count++;
}
return count;
}
string nod... | replace | 6 | 7 | 6 | 7 | 0 | |
p02279 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <random>
#include <vector>
using namespace std;
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define For(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define ALL(v) v.begin(), v.end()
const int NOT_DEFINED = -111;
class Tre... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <random>
#include <vector>
using namespace std;
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define For(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define ALL(v) v.begin(), v.end()
const int NOT_DEFINED = -111;
class Tre... | replace | 45 | 50 | 45 | 48 | TLE | |
p02279 | C++ | Runtime Error | #include <iostream>
#include <map>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define NIL -1
#define N 10005
struct Node {
int p, l, r;
};
Node T[N];
int n, r, D[N];
void print(int u) {
int i, c;
cout << "node " << u << ": ";
co... | #include <iostream>
#include <map>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define NIL -1
#define N 100005
struct Node {
int p, l, r;
};
Node T[N];
int n, r, D[N];
void print(int u) {
int i, c;
cout << "node " << u << ": ";
c... | replace | 11 | 12 | 11 | 12 | 0 | |
p02279 | C++ | Runtime Error | #include <stdio.h>
int depth(int node, int d[]) { return d[node]; }
void search(int i, int depth, int d[], int mark[], int b[]) {
d[i] = depth;
int index = mark[i];
int count = b[index]; // nuber of children
for (int j = 0; j < count; j++) {
search(b[index + 1 + j], depth + 1, d, mark, b);
}
}
void pre_p... | #include <stdio.h>
int depth(int node, int d[]) { return d[node]; }
void search(int i, int depth, int d[], int mark[], int b[]) {
d[i] = depth;
int index = mark[i];
int count = b[index]; // nuber of children
for (int j = 0; j < count; j++) {
search(b[index + 1 + j], depth + 1, d, mark, b);
}
}
void pre_p... | replace | 51 | 52 | 51 | 52 | 0 | |
p02279 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
vector<int> E[10000];
int d[100000], pr[100000];
void rec(int v, int p) {
d[v] = p;
for (int u : E[v])
rec(u, p + 1);
}
int main() {
int n;
scanf("%d", &n);
memset(pr, -1, sizeof(pr));
rep(i, n) {
int id, k... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
vector<int> E[100000];
int d[100000], pr[100000];
void rec(int v, int p) {
d[v] = p;
for (int u : E[v])
rec(u, p + 1);
}
int main() {
int n;
scanf("%d", &n);
memset(pr, -1, sizeof(pr));
rep(i, n) {
int id, ... | replace | 4 | 5 | 4 | 5 | 0 | |
p02279 | C++ | Runtime Error | #include <iostream>
using namespace std;
#define MAX 10005
#define NIL -1
typedef struct {
int p, l, r;
} Node;
Node T[MAX];
int n, D[MAX];
void print(int u) {
int i, c;
cout << "node " << u << ": ";
cout << "parent = " << T[u].p << ", ";
cout << "depth = " << D[u] << ", ";
if (T[u].p == NIL) {
cout... | #include <iostream>
using namespace std;
#define MAX 100005
#define NIL -1
typedef struct {
int p, l, r;
} Node;
Node T[MAX];
int n, D[MAX];
void print(int u) {
int i, c;
cout << "node " << u << ": ";
cout << "parent = " << T[u].p << ", ";
cout << "depth = " << D[u] << ", ";
if (T[u].p == NIL) {
cou... | replace | 2 | 3 | 2 | 3 | 0 | |
p02279 | C++ | Time Limit Exceeded | #include <cstdio>
#include <iostream>
#include <string>
using namespace std;
class Node {
public:
int parent;
int right_sibling;
int left_child;
int depth;
Node() {
parent = -1;
right_sibling = -1;
left_child = -1;
depth = -1;
}
};
void set_depth(Node *nodes, int id, int d) {
nodes[id].d... | #include <cstdio>
#include <iostream>
#include <string>
using namespace std;
class Node {
public:
int parent;
int right_sibling;
int left_child;
int depth;
Node() {
parent = -1;
right_sibling = -1;
left_child = -1;
depth = -1;
}
};
void set_depth(Node *nodes, int id, int d) {
nodes[id].d... | replace | 85 | 87 | 85 | 97 | TLE | |
p02279 | C++ | Runtime Error | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <stdio.h>
#include <vector>
using namespace std;
map<int, int> mpa, mpb;
#define MAX 100005
#define NIL -1
struct Node {
int p, l, r;
};
Node T[MAX];
int n, D... | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <stdio.h>
#include <vector>
using namespace std;
map<int, int> mpa, mpb;
#define MAX 100005
#define NIL -1
struct Node {
int p, l, r;
};
Node T[MAX];
int n, D... | replace | 59 | 60 | 59 | 60 | -11 | |
p02279 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
const int MAX = 10005;
const int NIL = -1;
struct Node {
int p, l, r;
};
Node Tree[MAX];
int n, Depth[MAX];
void print(int u) {
printf("node %d: ", u);
printf("parent = %d, ", Tree[u].p);
printf("depth = %d, ", De... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
const int MAX = 100005;
const int NIL = -1;
struct Node {
int p, l, r;
};
Node Tree[MAX];
int n, Depth[MAX];
void print(int u) {
printf("node %d: ", u);
printf("parent = %d, ", Tree[u].p);
printf("depth = %d, ", D... | replace | 5 | 6 | 5 | 6 | 0 | |
p02279 | C++ | Runtime Error | #define scanf_s scanf
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define MAX 1000
// #define MAX_ 1000
int cou = 0;
struct tree {
int id;
tree *pp;
tree *n... | #define scanf_s scanf
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define MAX 100000
// #define MAX_ 1000
int cou = 0;
struct tree {
int id;
tree *pp;
tree ... | replace | 13 | 14 | 13 | 14 | 0 | |
p02279 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <limits>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define INT_MAX 2147483647
#define INT_MIN -2147483647
#define NUM 10000
#define INVALID_IDX -1
using namespace std;
struct TreeNode {
int p, l, r;
};
TreeNode t[NUM];
int D[NUM];
void... | #include <algorithm>
#include <iostream>
#include <limits>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define INT_MAX 2147483647
#define INT_MIN -2147483647
#define NUM 100005
#define INVALID_IDX -1
using namespace std;
struct TreeNode {
int p, l, r;
};
TreeNode t[NUM];
int D[NUM];
voi... | replace | 11 | 12 | 11 | 12 | 0 | |
p02280 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define INT_MAX 2147483647
#de... | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define INT_MAX 2147483647
#de... | replace | 60 | 61 | 60 | 63 | 0 | |
p02280 | C++ | Runtime Error | #include <iostream>
#include <string>
using namespace std;
const int N = 25;
const int NIL = -1;
struct Node {
int parent, left, right;
};
void set_depth(int id, int dep, int depth[], Node T[]) {
depth[id] = dep;
if (T[id].left != NIL)
set_depth(T[id].left, dep + 1, depth, T);
if (T[id].right != NIL)
... | #include <iostream>
#include <string>
using namespace std;
const int N = 25;
const int NIL = -1;
struct Node {
int parent, left, right;
};
void set_depth(int id, int dep, int depth[], Node T[]) {
depth[id] = dep;
if (T[id].left != NIL)
set_depth(T[id].left, dep + 1, depth, T);
if (T[id].right != NIL)
... | replace | 46 | 49 | 46 | 51 | 0 | |
p02280 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
struct TNode {
int Id;
TNode *Parent;
TNode *LChild;
TNode *RChild;
};
//???????????????????????????TNode*???????????????(vector??????????????¢?????????????????????)
class TTable {
private:
vector<TNode *> Node... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
struct TNode {
int Id;
TNode *Parent;
TNode *LChild;
TNode *RChild;
};
//???????????????????????????TNode*???????????????(vector??????????????¢?????????????????????)
class TTable {
private:
vector<TNode *> Node... | insert | 146 | 146 | 146 | 152 | 0 | |
p02280 | C++ | Runtime Error | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T... | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T... | replace | 23 | 24 | 23 | 24 | 0 | |
p02280 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <math.h>
#define Lens 250
#define Nil -1
using namespace std;
struct Node {
int p, l, r;
};
int N;
Node Tr[Lens];
int D[Lens], C[Lens], H[Lens];
bool V[Lens];
// 建树
void maketree() {
int m, l, r;
for (int i = 0; i < N; i++) {
cin >> m >>... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <math.h>
#define Lens 250
#define Nil -1
using namespace std;
struct Node {
int p, l, r;
};
int N;
Node Tr[Lens];
int D[Lens], C[Lens], H[Lens];
bool V[Lens];
// 建树
void maketree() {
int m, l, r;
for (int i = 0; i < N; i++) {
cin >> m >>... | replace | 45 | 53 | 45 | 52 | 0 | |
p02280 | C++ | Runtime Error | #include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
struct Node {
int id;
Node *parent, *left, *right;
};
int n;
Node **nodes;
inline int getheight(int id) {
Node *node = nodes[id];
int left_height = 0, right_height = 0;
if (node->left) {
left_height = 1 + getheight(node->lef... | #include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
struct Node {
int id;
Node *parent, *left, *right;
};
int n;
Node **nodes;
inline int getheight(int id) {
Node *node = nodes[id];
int left_height = 0, right_height = 0;
if (node->left) {
left_height = 1 + getheight(node->lef... | replace | 70 | 74 | 70 | 75 | 0 | |
p02280 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
struct TNode {
int Index;
TNode *Parent;
TNode *Left;
TNode *Right;
TNode();
};
TNode::TNode() {
Index = -1;
Parent = NULL;
Left = NULL;
Right = NULL;
}
typedef std::vector<TNode> TBinaryTree;
void InputNode(TBinaryTree ... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
struct TNode {
int Index;
TNode *Parent;
TNode *Left;
TNode *Right;
TNode();
};
TNode::TNode() {
Index = -1;
Parent = NULL;
Left = NULL;
Right = NULL;
}
typedef std::vector<TNode> TBinaryTree;
void InputNode(TBinaryTree ... | replace | 48 | 49 | 48 | 51 | 0 | |
p02280 | C++ | Runtime Error | #include <iostream>
using namespace std;
#define MAX 10000
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL) {
return;
}
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeigh... | #include <iostream>
using namespace std;
#define MAX 10000
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL) {
return;
}
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeigh... | replace | 84 | 85 | 84 | 85 | -11 | |
p02280 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
struct node {
node() {
parent = -1;
depth = 0;
s = -1;
}
void set(const int c1, const int c2) {
... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
struct node {
node() {
parent = -1;
depth = 0;
s = -1;
}
void set(const int c1, const int c2) {
... | replace | 26 | 27 | 26 | 31 | 0 | |
p02280 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 100000;
struct Node {
int parent, left, right;
};
Node node[MAX];
int getDepth(int i) {
int j = i;
int d = 0;
while (node[j].parent != -1) {
j = node[j].parent;
d++;
}
return d;
}
int getHeight(int i) {
if (n... | #include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 100000;
struct Node {
int parent, left, right;
};
Node node[MAX];
int getDepth(int i) {
int j = i;
int d = 0;
while (node[j].parent != -1) {
j = node[j].parent;
d++;
}
return d;
}
int getHeight(int i) {
if (i... | replace | 23 | 26 | 23 | 27 | 0 | |
p02280 | C++ | Runtime Error | #include <stdio.h>
#include <vector>
using namespace std;
struct Node {
Node() {
brother = parent = -1;
height = depth = num_of_children = 0;
}
int parent, brother, depth, num_of_children, height;
vector<int> children;
};
void calcDepth(Node nodes[], int root_id) {
for (int i = 0; i < nodes[root_id... | #include <stdio.h>
#include <vector>
using namespace std;
struct Node {
Node() {
brother = parent = -1;
height = depth = num_of_children = 0;
}
int parent, brother, depth, num_of_children, height;
vector<int> children;
};
void calcDepth(Node nodes[], int root_id) {
for (int i = 0; i < nodes[root_id... | replace | 38 | 45 | 38 | 47 | 0 | |
p02280 | C++ | Time Limit Exceeded | #define FILE_INPUT_DEFINE
#ifdef FILE_INPUT_DEFINE
#include <fstream>
#endif // FILE_INPUT_DEFINE
#include <cstdio>
#include <iostream>
#define NIL (-1)
#define MAX 25
enum class RLI { eRoot, eInternalNode, eLeaf };
struct BinaryTree {
int parent;
int left;
int right;
int depth;
int sibling;
int degree;... | // #define FILE_INPUT_DEFINE
#ifdef FILE_INPUT_DEFINE
#include <fstream>
#endif // FILE_INPUT_DEFINE
#include <cstdio>
#include <iostream>
#define NIL (-1)
#define MAX 25
enum class RLI { eRoot, eInternalNode, eLeaf };
struct BinaryTree {
int parent;
int left;
int right;
int depth;
int sibling;
int deg... | replace | 0 | 1 | 0 | 1 | TLE | |
p02280 | C++ | Runtime Error | ///
// File: alds1_7_b.cpp
// Author: ymiyamoto
//
// Created on Sat Oct 14 16:06:54 2017
//
#include <cstdint>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define NIL -1
#define SIZE 100
struct tree_t {
int32_t right;
int32_t left;
int32_t parent;
tree_t() { parent = NIL;... | ///
// File: alds1_7_b.cpp
// Author: ymiyamoto
//
// Created on Sat Oct 14 16:06:54 2017
//
#include <cstdint>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define NIL -1
#define SIZE 100
struct tree_t {
int32_t right;
int32_t left;
int32_t parent;
tree_t() { parent = NIL;... | replace | 56 | 57 | 56 | 57 | 0 | |
p02280 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
const int nmax = 9;
int root;
vector<int> dep(nmax), par(nmax), high(nmax);
vector<int> des[nmax];
void dep_dfs(int id) {
for (int i = 0; i < (int)des[id].size(); i++) {
dep[des[id][i]] = dep[id... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
const int nmax = 100;
int root;
vector<int> dep(nmax), par(nmax), high(nmax);
vector<int> des[nmax];
void dep_dfs(int id) {
for (int i = 0; i < (int)des[id].size(); i++) {
dep[des[id][i]] = dep[... | replace | 7 | 8 | 7 | 8 | 0 | |
p02281 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
void Preorder(vector<vector<int>> &T, int root) {
cout << " " << root;
if (T[root][0] != -1)
Preorder(T, T[root][0]);
if (T[root][1] != -1)
Preorder(T, T[root][1]);
return;
}
void Inorder(vector<vector<int>> &T, int root) {
if (T[root][0] !=... | #include <iostream>
#include <vector>
using namespace std;
void Preorder(vector<vector<int>> &T, int root) {
cout << " " << root;
if (T[root][0] != -1)
Preorder(T, T[root][0]);
if (T[root][1] != -1)
Preorder(T, T[root][1]);
return;
}
void Inorder(vector<vector<int>> &T, int root) {
if (T[root][0] !=... | replace | 43 | 44 | 43 | 45 | -6 | double free or corruption (out)
|
p02281 | C++ | Runtime Error | #include <cstdio>
#include <vector>
class Node {
public:
int id;
int left_id;
int right_id;
int parent_id;
Node();
};
Node::Node() {
id = -1;
left_id = -1;
right_id = -1;
parent_id = -1;
}
int search_root(std::vector<Node> &data, int id) {
if (data[id].parent_id == -1) {
return id;
} else {... | #include <cstdio>
#include <vector>
class Node {
public:
int id;
int left_id;
int right_id;
int parent_id;
Node();
};
Node::Node() {
id = -1;
left_id = -1;
right_id = -1;
parent_id = -1;
}
int search_root(std::vector<Node> &data, int id) {
if (data[id].parent_id == -1) {
return id;
} else {... | replace | 42 | 43 | 42 | 43 | 0 | |
p02281 | C++ | Time Limit Exceeded | #include <cstring>
#include <iostream>
using namespace std;
int x[1000][5]; // 0=left,1=right,2=parent,3=sibling;
void S1(int u) {
if (u == -1) {
return;
}
cout << ' ' << u;
S1(x[u][0]);
S1(x[u][1]);
}
void S2(int u) {
if (u == -1) {
return;
}
S2(x[u][0]);
cout << ' ' << u;
S2(x[u][1]);
}... | #include <cstring>
#include <iostream>
using namespace std;
int x[1000][5]; // 0=left,1=right,2=parent,3=sibling;
void S1(int u) {
if (u == -1) {
return;
}
cout << ' ' << u;
S1(x[u][0]);
S1(x[u][1]);
}
void S2(int u) {
if (u == -1) {
return;
}
S2(x[u][0]);
cout << ' ' << u;
S2(x[u][1]);
}... | replace | 39 | 43 | 39 | 44 | TLE | |
p02281 | C++ | Memory Limit Exceeded | // ALDS1_7_C.cpp
// Tree - Tree Walk
#include <iostream>
#include <vector>
using namespace std;
struct Node {
int id;
int lchild;
int rchild;
int parent = -1;
};
void Preorder(vector<Node> &nodes, int id) {
cout << " " << nodes[id].id;
if (nodes[id].lchild == -1 && nodes[id].rchild == -1) {
return;
... | // ALDS1_7_C.cpp
// Tree - Tree Walk
#include <iostream>
#include <vector>
using namespace std;
struct Node {
int id;
int lchild;
int rchild;
int parent = -1;
};
void Preorder(vector<Node> &nodes, int id) {
cout << " " << nodes[id].id;
if (nodes[id].lchild != -1)
Preorder(nodes, nodes[id].lchild);
... | replace | 16 | 21 | 16 | 20 | MLE | |
p02281 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define REP(asd, fgh) for (int asd = 0; asd < fgh; asd++)
int n;
class Node {
public:
int p;
int depth;
int height;
int sibling;
int degree;
string type;
};
vector<Node> ans;
vector<vector<int>> t;
void dfs(int ind, int prev, int depth, int order) {
if (t[... | #include <bits/stdc++.h>
using namespace std;
#define REP(asd, fgh) for (int asd = 0; asd < fgh; asd++)
int n;
class Node {
public:
int p;
int depth;
int height;
int sibling;
int degree;
string type;
};
vector<Node> ans;
vector<vector<int>> t;
void dfs(int ind, int prev, int depth, int order) {
if (t[... | delete | 64 | 71 | 64 | 64 | 0 | |
p02281 | C++ | Runtime Error | #include <cstdio>
#include <vector>
enum order {
preorder = 0,
inorder = 1,
postorder = 2,
};
class BinaryTree {
private:
int numVertex;
int *parent, *left, *right;
public:
BinaryTree(int v);
~BinaryTree();
void init();
void dfs(int v, order flag);
std::vector<int> root();
};
BinaryTree::BinaryTree... | #include <cstdio>
#include <vector>
enum order {
preorder = 0,
inorder = 1,
postorder = 2,
};
class BinaryTree {
private:
int numVertex;
int *parent, *left, *right;
public:
BinaryTree(int v);
~BinaryTree();
void init();
void dfs(int v, order flag);
std::vector<int> root();
};
BinaryTree::BinaryTree... | replace | 39 | 41 | 39 | 43 | -6 | double free or corruption (out)
|
p02281 | C++ | Runtime Error | ///
// File: alds1_7_c.cpp
// Author: ymiyamoto
//
// Created on Sat Oct 14 18:52:33 2017
//
#include <cstdint>
#include <iostream>
#include <vector>
using namespace std;
struct tree_t {
int32_t parent;
int32_t left;
int32_t right;
tree_t() {
parent = -1;
left = -1;
right = -1;
}
};
#define S... | ///
// File: alds1_7_c.cpp
// Author: ymiyamoto
//
// Created on Sat Oct 14 18:52:33 2017
//
#include <cstdint>
#include <iostream>
#include <vector>
using namespace std;
struct tree_t {
int32_t parent;
int32_t left;
int32_t right;
tree_t() {
parent = -1;
left = -1;
right = -1;
}
};
#define S... | replace | 53 | 55 | 53 | 59 | 0 | |
p02281 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
struct binarytree {
int parent, left, right;
};
int order(vector<binarytree> &node, int i, int mode) {
int e1, e2;
if (mode == 0)
cout << " " << i;
e1 = node[i].left;
if (e1 != -1)
order(node, e1, mo... | #include <algorithm>
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
struct binarytree {
int parent, left, right;
};
int order(vector<binarytree> &node, int i, int mode) {
int e1, e2;
if (mode == 0)
cout << " " << i;
e1 = node[i].left;
if (e1 != -1)
order(node, e1, mo... | replace | 23 | 24 | 23 | 24 | 0 | |
p02282 | C++ | Runtime Error | #include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
struct node {
int left, right;
} nodes[100];
int n, pre[105], in[105], inloc[105], cnt = 0;
int rec(int s, int e) {
if (s < e) {
int m = inloc[pre[cnt++]];
int l = rec(s, m - 1);
int r = rec(m + 1, e);
nodes[in[m]].l... | #include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
struct node {
int left, right;
} nodes[100];
int n, pre[105], in[105], inloc[105], cnt = 0;
int rec(int s, int e) {
if (s < e) {
int m = inloc[pre[cnt++]];
int l = rec(s, m - 1);
int r = rec(m + 1, e);
nodes[in[m]].l... | insert | 20 | 20 | 20 | 21 | 0 | |
p02282 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
struct Node {
int id;
int parent;
int left;
int right;
Node() : id(), parent(-1), left(-1), right(-1) {}
};
static vector<Node> TREE(25);
static void inputNode(Node &node, int id) {
node.id = id;
cin >> node.left >> node.... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
static vector<int> preorder(100), inorder(100);
static void inputOrder(vector<int> &order, int num) {
for (int i = 0; i < num; i++) {
cin >> order[i];
}
}
static int current = 0, outIndex = 0;
static int next() {
int c = preo... | replace | 6 | 23 | 6 | 7 | 0 | |
p02282 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pu... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pu... | replace | 35 | 36 | 35 | 37 | -11 | |
p02282 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l = r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pus... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l == r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pu... | replace | 10 | 11 | 10 | 11 | -11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.