buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
#include <stdio.h> #include <stdlib.h> int main() { int num[36], A[36]; char mar[36], Am[36]; int N, i, j, boxi, flag = 0, minj, box; char boxc; scanf("%d", &N); for (i = 0; i < N; i++) { scanf(" %c%d", &mar[i], &num[i]); } for (i = 0; i < N; i++) { Am[i] = mar[i]; A[i] = num[i]; } ...
#include <stdio.h> #include <stdlib.h> int main() { int num[36], A[36]; char mar[36], Am[36]; int N, i, j, boxi, flag = 0, minj, box; char boxc; scanf("%d", &N); for (i = 0; i < N; i++) { scanf(" %c%d", &mar[i], &num[i]); } for (i = 0; i < N; i++) { Am[i] = mar[i]; A[i] = num[i]; } ...
[["-", 8, 9, 0, 57, 15, 23, 0, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 60]]
0
512
2
#include <stdio.h> struct Card { char suit; int value; }; void bubble(struct Card A[], int n) { int i, j; for (i = 0; i < n; i++) { for (j = n - 1; j >= i + 1; j--) { if (A[j].value < A[j - 1].value) { struct Card t = A[j]; A[j] = A[j - 1]; A[j - 1] = t; } } } } ...
#include <stdio.h> struct Card { char suit; int value; }; void bubble(struct Card A[], int n) { int i, j; for (i = 0; i < n; i++) { for (j = n - 1; j >= i + 1; j--) { if (A[j].value < A[j - 1].value) { struct Card t = A[j]; A[j] = A[j - 1]; A[j - 1] = t; } } } } ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
515
2
#include <stdio.h> #include <string.h> int i, j; typedef struct { char design; char number; } Card; void bubble(Card A[], int n) { Card t; for (i = 0; i < n; i++) { for (j = n - 1; j >= i + 1; j--) { if (A[j].number < A[j - 1].number) { t = A[j]; A[j] = A[j - 1]; A[j - i] = t...
#include <stdio.h> #include <string.h> int i, j; typedef struct { char design; char number; } Card; void bubble(Card A[], int n) { Card t; for (i = 0; i < n; i++) { for (j = n - 1; j >= i + 1; j--) { if (A[j].number < A[j - 1].number) { t = A[j]; A[j] = A[j - 1]; A[j - 1] = t...
[["-", 0, 1, 0, 11, 31, 69, 71, 16, 12, 22], ["+", 0, 1, 0, 11, 31, 69, 71, 16, 12, 13]]
0
511
2
#include <stdio.h> typedef struct { char mark; char num; } cards; void bubble(cards C[], int N) { int i, j; for (i = 0; i < N; i++) { for (j = N - 1; j >= i; j--) { if (C[j].num < C[j - 1].num) { cards b; b = C[j]; C[j] = C[j - 1]; C[j - 1] = b; } } } } vo...
#include <stdio.h> typedef struct { char mark; char num; } cards; void bubble(cards C[], int N) { int i, j; for (i = 0; i < N; i++) { for (j = N - 1; j >= i; j--) { if (C[j].num < C[j - 1].num) { cards b; b = C[j]; C[j] = C[j - 1]; C[j - 1] = b; } } } } vo...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
591
2
#include <stdbool.h> #include <stdio.h> typedef struct { char gara; int value; } Huda; void bubbleSort(Huda[], int); void selectionSort(Huda[], int); void printArray(Huda[], int); bool isStable(Huda[], Huda[], int N); int main() { Huda H1[50]; Huda H2[50]; int n; char ch; int i; scanf("%d", &n); fo...
#include <stdbool.h> #include <stdio.h> typedef struct { char gara; int value; } Huda; void bubbleSort(Huda[], int); void selectionSort(Huda[], int); void printArray(Huda[], int); bool isStable(Huda[], Huda[], int N); int main() { Huda H1[50]; Huda H2[50]; int n; char ch; int i; scanf("%d", &n); fo...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
584
2
#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; struct Card { char suit, value; }; void trace(struct Card A[], int n) { for (int i ...
#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; struct Card { char suit, value; }; void trace(struct Card A[], int n) { for (int i ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
549
2
#include <iostream> using namespace std; class Card { public: char suit, value; }; void bubble(Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j > i; j--) { if (A[j - 1].value > A[j].value) { swap(A[j], A[j - 1]); } } } } void selection(Card A[], int N) { for ...
#include <iostream> using namespace std; class Card { public: char suit, value; }; void bubble(Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j > i; j--) { if (A[j - 1].value > A[j].value) { swap(A[j], A[j - 1]); } } } } void selection(Card A[], int N) { for ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
458
2
#include <iostream> #include <stdio.h> using namespace std; void bubbleSort(int *C, char *S, int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j > i; j--) { if (C[j] < C[j - 1]) { int tn = C[j]; C[j] = C[j - 1]; C[j - 1] = tn; char ts = S[j]; S[j] = S[j - 1...
#include <iostream> #include <stdio.h> using namespace std; void bubbleSort(int *C, char *S, int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j > i; j--) { if (C[j] < C[j - 1]) { int tn = C[j]; C[j] = C[j - 1]; C[j - 1] = tn; char ts = S[j]; S[j] = S[j - 1...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
541
6
#include <iostream> #define MAX_N 105 using namespace std; struct Card { char suit; int value; }; void BubbleSort(Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i + 1; j--) { if (A[j].value < A[j - 1].value) { swap(A[j], A[j - 1]); } } } } void Selecti...
#include <iostream> #define MAX_N 105 using namespace std; struct Card { char suit; int value; }; void BubbleSort(Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i + 1; j--) { if (A[j].value < A[j - 1].value) { swap(A[j], A[j - 1]); } } } } void Selecti...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
481
2
#include <memory.h> #include <stdio.h> #define arr_print_card(a, n) \ for (int i = 0; i < (n); ++i) \ printf(i == (n)-1 ? "%c%d\n" : "%c%d ", (a)[i].symbol, (a)[i].num) typedef struct Card { char symbol; int num; ...
#include <memory.h> #include <stdio.h> #define arr_print_card(a, n) \ for (int i = 0; i < (n); ++i) \ printf(i == (n)-1 ? "%c%d\n" : "%c%d ", (a)[i].symbol, (a)[i].num) typedef struct Card { char symbol; int num; ...
[["-", 0, 2, 3, 4, 0, 41, 75, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 75, 5, 0, 6]]
1
457
2
#include <iostream> #include <string> #include <vector> using namespace std; int BubbleSort(vector<string> &, const int); void writeVector(const vector<string> &); int SelectionSort(vector<string> &, const int); bool IsStable(vector<string> &, vector<string> &); bool IsStable(vector<string> &original_v, vector<string...
//============================================================================ // Name : SelectionSort.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #incl...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
837
2
#include <algorithm> #include <cstdio> #include <cstdlib> #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; void selsort(string a[], int n) { for (int i = 0; i < n; i++) { int minj = i; for (int j = i; j < n; j++) if (a[j][1] < a[minj][1]) minj = j;...
#include <algorithm> #include <cstdio> #include <cstdlib> #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; void selsort(string a[], int n) { for (int i = 0; i < n; i++) { int minj = i; for (int j = i; j < n; j++) if (a[j][1] < a[minj][1]) minj = j;...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
415
2
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <sstream> #include <stdlib.h> #include <string> #include <vector> using namespace std; void selectionsort(vector<string> &A) { int minj, i, j; int n = A.size(); for (i = 0; i < n - 1; i++) { minj = i; for (j = i; j < n...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <sstream> #include <stdlib.h> #include <string> #include <vector> using namespace std; void selectionsort(vector<string> &A) { int minj, i, j; int n = A.size(); for (i = 0; i < n - 1; i++) { minj = i; for (j = i; j < n...
[["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 17, 151], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
502
5
#include <iostream> using namespace std; struct Card { char suit, value; }; void bubbleSort(struct Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i + 1; j--) { if (A[j].value < A[j - 1].value) { Card t = A[j]; A[j] = A[j - 1]; A[j - 1] = t; } ...
#include <iostream> using namespace std; struct Card { char suit, value; }; void bubbleSort(struct Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i + 1; j--) { if (A[j].value < A[j - 1].value) { Card t = A[j]; A[j] = A[j - 1]; A[j - 1] = t; } ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
477
4
#include <iostream> #include <vector> using namespace std; int main() { int n, p = 1, minj; cin >> n; vector<string> data1(n), data2(n); for (int i = 0; i < n; i++) { cin >> data1[i]; data2[i] = data1[i]; } while (p != 0) { p = 0; for (int i = n - 1; i > 0; i--) { if (data1[i][1] < dat...
#include <iostream> #include <vector> using namespace std; int main() { int n, p = 1, minj; cin >> n; vector<string> data1(n), data2(n); for (int i = 0; i < n; i++) { cin >> data1[i]; data2[i] = data1[i]; } while (p != 0) { p = 0; for (int i = n - 1; i > 0; i--) { if (data1[i][1] < dat...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
344
2
#include <iostream> using namespace std; struct Card { char suit; char value; int i; }; void bubble(struct Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i + 1; j--) { if (A[j].value < A[j - 1].value) { Card temp = A[j]; A[j] = A[j - 1]; A[j - 1] = ...
#include <iostream> using namespace std; struct Card { char suit; char value; int i; }; void bubble(struct Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i + 1; j--) { if (A[j].value < A[j - 1].value) { Card temp = A[j]; A[j] = A[j - 1]; A[j - 1] = ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
515
4
#include <iostream> using namespace std; struct Ca { char mark, va; }; void BubbleSort(struct Ca A[], int N) { int i, j; for (i = 0; i < N; i++) { for (j = N - 1; j >= i; j--) { if (A[j].va < A[j - 1].va) { Ca b = A[j]; A[j] = A[j - 1]; A[j - 1] = b; } } } } void S...
#include <iostream> using namespace std; struct Ca { char mark, va; }; void BubbleSort(struct Ca A[], int N) { int i, j; for (i = 0; i < N; i++) { for (j = N - 1; j >= i; j--) { if (A[j].va < A[j - 1].va) { Ca b = A[j]; A[j] = A[j - 1]; A[j - 1] = b; } } } } void S...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
495
4
#include <iostream> using namespace std; struct card { char suit; int value; }; void bubbleSort(card a[], int n) { int flag = 1; for (int i = 0; i < n - 1; ++i) { if (!flag) break; flag = 0; for (int j = n - 1; j > i; j--) { if (a[j].value < a[j - 1].value) { flag = 1; ...
#include <iostream> using namespace std; struct card { char suit; int value; }; void bubbleSort(card a[], int n) { int flag = 1; for (int i = 0; i < n - 1; ++i) { if (!flag) break; flag = 0; for (int j = n - 1; j > i; j--) { if (a[j].value < a[j - 1].value) { flag = 1; ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
492
2
#include <stdio.h> struct Card { char suit; char value; }; void bubble(Card A[], int n) { int i, j; Card t; for (i = 1; i <= n; i++) { for (j = n; j >= i + 1; j--) { if (A[j].value < A[j - 1].value) { t = A[j]; A[j] = A[j - 1]; A[j - 1] = t; } } } } void select...
#include <stdio.h> struct Card { char suit; char value; }; void bubble(Card A[], int n) { int i, j; Card t; for (i = 1; i <= n; i++) { for (j = n; j >= i + 1; j--) { if (A[j].value < A[j - 1].value) { t = A[j]; A[j] = A[j - 1]; A[j - 1] = t; } } } } void select...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
515
2
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; typedef vector<string> svector; int bubblesort(svector &A) { int n = A.size(); for (int i = 0; i < n; i++) for (int j = n - 1; j > i; j--) if (A[j][1] < A[j - 1][1]) { swap(A[j], A[j - 1]); } ...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; typedef vector<string> svector; int bubblesort(svector &A) { int n = A.size(); for (int i = 0; i < n; i++) for (int j = n - 1; j > i; j--) if (A[j][1] < A[j - 1][1]) { swap(A[j], A[j - 1]); } ...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
376
2
/* stable or not stableの判定法は ソート済みのCの0番目の要素を軸にoriginalを探索。 アイデアのキモ: {もしCの次の数字が違えば、探索添え字を0に戻す。 もし同じなら、探索添え字はそのまま。 } stableならこれですべて探せるはず 最後まで見つからなかったらnotstable */ #include <iostream> #include <string> using namespace std; //多重ループをうまく抜けられなかったので関数にすることに // goto使ってもよかったんだけど、まあ・・・。 /* stableかかを文字列で返してくれる。 引数は比較するstring配...
/* stable or not stableの判定法は ソート済みのCの0番目の要素を軸にoriginalを探索。 アイデアのキモ: {もしCの次の数字が違えば、探索添え字を0に戻す。 もし同じなら、探索添え字はそのまま。 } stableならこれですべて探せるはず 最後まで見つからなかったらnotstable */ #include <iostream> #include <string> using namespace std; //多重ループをうまく抜けられなかったので関数にすることに // goto使ってもよかったんだけど、まあ・・・。 /* stableかかを文字列で返してくれる。 引数は比較するstring配...
[["-", 8, 9, 0, 57, 64, 37, 0, 5, 0, 6], ["+", 8, 9, 0, 57, 64, 37, 0, 5, 0, 6], ["-", 0, 14, 8, 9, 0, 37, 0, 5, 0, 6], ["+", 0, 14, 8, 9, 0, 37, 0, 5, 0, 6]]
1
483
4
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int n; struct card { char suit; char num; }; void bubble_sort(card c1[]) { for (int i = 0; i < n; i++) { for (int j = n - 1; j > i; j--) { if (c1[j - 1].num > c1[j].num) { card t = c1[j - 1]; c1[j - 1] =...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int n; struct card { char suit; char num; }; void bubble_sort(card c1[]) { for (int i = 0; i < n; i++) { for (int j = n - 1; j > i; j--) { if (c1[j - 1].num > c1[j].num) { card t = c1[j - 1]; c1[j - 1] =...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
445
2
#include <algorithm> #include <bitset> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <...
#include <algorithm> #include <bitset> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
385
2
#include <iostream> using namespace std; struct Card { char number; char mark; int id; }; void printResult(bool isStable) { if (isStable) cout << "Stable" << endl; else cout << "Not Stable" << endl; return; } int main() { Card bubbleCard[36]; Card selectionCard[36]; char dubbleList[36]; ...
#include <iostream> using namespace std; struct Card { char number; char mark; int id; }; void printResult(bool isStable) { if (isStable) cout << "Stable" << endl; else cout << "Not stable" << endl; return; } int main() { Card bubbleCard[36]; Card selectionCard[36]; char dubbleList[36]; ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
557
2
#include <iostream> #include <string> #include <vector> #include <cstdlib> using namespace std; vector<pair<char, int>> B; vector<pair<char, int>> SelectionSort(vector<pair<char, int>> v) { for (int i = 0; i < v.size(); i++) { int mini = i; for (int j = i; j < v.size(); j++) { if (v[j].second < v[mi...
#include <iostream> #include <string> #include <vector> #include <cstdlib> using namespace std; vector<pair<char, int>> B; vector<pair<char, int>> SelectionSort(vector<pair<char, int>> v) { for (int i = 0; i < v.size(); i++) { int mini = i; for (int j = i; j < v.size(); j++) { if (v[j].second < v[mi...
[["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
621
2
#include <cstdio> #include <iostream> using namespace std; struct CARD { char ch; int n; }; template <class T> void bubbleSort(T *array, int size) { for (int i = size; i > 0; i--) { for (int j = 0; j < i - 1; j++) { if (array[j].n > array[j + 1].n) { T tmp = array[j + 1]; array[j + 1] ...
#include <cstdio> #include <iostream> using namespace std; struct CARD { char ch; int n; }; template <class T> void bubbleSort(T *array, int size) { for (int i = size; i > 0; i--) { for (int j = 0; j < i - 1; j++) { if (array[j].n > array[j + 1].n) { T tmp = array[j + 1]; array[j + 1] ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
625
2
#include <bits/stdc++.h> using namespace std; void swap(string &card1, string &card2) { string tmp = card1; card1 = card2; card2 = tmp; } int peek_number(string card) { return atoi(&card[1]); } vector<string> bubble_sort(vector<string> cards) { for (int i = 0; i < cards.size(); i++) { for (int j = cards...
#include <bits/stdc++.h> using namespace std; void swap(string &card1, string &card2) { string tmp = card1; card1 = card2; card2 = tmp; } int peek_number(string card) { return atoi(&card[1]); } vector<string> bubble_sort(vector<string> cards) { for (int i = 0; i < cards.size(); i++) { for (int j = cards...
[["-", 12, 23, 0, 41, 15, 2, 3, 4, 0, 22], ["+", 12, 23, 0, 41, 15, 2, 3, 4, 0, 22]]
1
465
2
#include <iostream> using namespace std; struct card { char suit, value; }; void bubble(struct card A[], int n) { for (int i = 0; i < n; i++) { for (int j = n - 1; j >= i + 1; j--) { if (A[j - 1].value > A[j].value) swap(A[j], A[j - 1]); } } } void selection(struct card A[], int n) { int m...
#include <iostream> using namespace std; struct card { char suit, value; }; void bubble(struct card A[], int n) { for (int i = 0; i < n; i++) { for (int j = n - 1; j >= i + 1; j--) { if (A[j - 1].value > A[j].value) swap(A[j], A[j - 1]); } } } void selection(struct card A[], int n) { int m...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
442
5
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <vector> #define rep(i, n) Rep(i, 0, n) #define Rep(i, k, n) for (int i = k; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define vi vector<int> #define vii vector<int, int> #define Sort(v) sort(v.begin()...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <vector> #define rep(i, n) Rep(i, 0, n) #define Rep(i, k, n) for (int i = k; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define vi vector<int> #define vii vector<int, int> #define Sort(v) sort(v.begin()...
[["-", 0, 37, 0, 23, 0, 41, 75, 5, 0, 6], ["+", 0, 37, 0, 23, 0, 41, 75, 5, 0, 6]]
1
543
2
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { int N; cin >> N; string F[N]; string BK[N]; string BN[N]; string SK[N]; string SN[N]; for (int i = 0; i < N; i++) { cin >> F[i]; BK[i] = F[i].at(0); SK[i] = F[i].at(0); BN[i] = F[i].at(1); SN[i] = F[i].at(...
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { int N; cin >> N; string F[N]; string BK[N]; string BN[N]; string SK[N]; string SN[N]; for (int i = 0; i < N; i++) { cin >> F[i]; BK[i] = F[i].at(0); SK[i] = F[i].at(0); BN[i] = F[i].at(1); SN[i] = F[i].at(...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
495
2
#include <iostream> using namespace std; struct Card { char suit, value; }; void bubble(struct Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N; j > i; j--) { if (A[j].value < A[j - 1].value) { swap(A[j], A[j - 1]); } } } } void selection(struct Card A[], int N) { ...
#include <iostream> using namespace std; struct Card { char suit, value; }; void bubble(struct Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j > i; j--) { if (A[j].value < A[j - 1].value) { swap(A[j], A[j - 1]); } } } } void selection(struct Card A[], int N) ...
[["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
454
2
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; struct Card { char suit, value; }; void BubbleSort(struct Card A[], int N) { int flag = 1; int swap = 0; while (flag) { flag = 0; for (int i = N - 1; i >= 1; i--) { if (A[i].value < A[i - 1].value) ...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; struct Card { char suit, value; }; void BubbleSort(struct Card A[], int N) { int flag = 1; int swap = 0; while (flag) { flag = 0; for (int i = N - 1; i >= 1; i--) { if (A[i].value < A[i - 1].value) ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
578
4
#include <iostream> using namespace std; bool bubbleSort(string c[], int &n) { string hold; for (int i = 0; i < n; i++) { for (int j = n - 1; j >= 1; j--) { if (c[j][1] < c[j - 1][1]) { hold = c[j - 1]; c[j - 1] = c[j]; c[j] = hold; } } } return true; } bool select...
#include <iostream> using namespace std; bool bubbleSort(string c[], int &n) { string hold; for (int i = 0; i < n; i++) { for (int j = n - 1; j >= 1; j--) { if (c[j][1] < c[j - 1][1]) { hold = c[j - 1]; c[j - 1] = c[j]; c[j] = hold; } } } return true; } bool select...
[["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
479
2
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include ...
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include ...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
846
4
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; //カードの変数を2つ用意 //各々バブル。選択ソートでソート。 //各々の答えを引っ張ってきて、同じであれば安定、違うなら不安定 //ソートはアルファベットも同様にソートする struct Card { char suit, value; }; void bubbleSort(struct Card C1[], int n) { //バブルソート int flag = 1; for (int i = 0; flag; i++) { // f...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; //カードの変数を2つ用意 //各々バブル。選択ソートでソート。 //各々の答えを引っ張ってきて、同じであれば安定、違うなら不安定 //ソートはアルファベットも同様にソートする struct Card { char suit, value; }; void bubbleSort(struct Card C1[], int n) { //バブルソート int flag = 1; for (int i = 0; flag; i++) { // f...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
493
4
#include <iostream> struct Card { char suit, value; }; void bubble(struct Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i; j--) { if (A[j].value < A[j - 1].value) { Card t = A[j]; A[j] = A[j - 1]; A[j - 1] = t; } } } } void selection(struc...
#include <iostream> struct Card { char suit, value; }; void bubble(struct Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i; j--) { if (A[j].value < A[j - 1].value) { Card t = A[j]; A[j] = A[j - 1]; A[j - 1] = t; } } } } void selection(struc...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
511
2
#include <iostream> using namespace std; struct card { char suit; int num; }; void bubbleSort(struct card C[], int N) { bool flag = 1; for (int i = 0; flag; i++) { flag = 0; for (int j = N - 1; j >= i + 1; j--) { if (C[j].num < C[j - 1].num) { swap(C[j], C[j - 1]); flag = 1; ...
#include <iostream> using namespace std; struct card { char suit; int num; }; void bubbleSort(struct card C[], int N) { bool flag = 1; for (int i = 0; flag; i++) { flag = 0; for (int j = N - 1; j >= i + 1; j--) { if (C[j].num < C[j - 1].num) { swap(C[j], C[j - 1]); flag = 1; ...
[["-", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22]]
1
583
4
#include <iostream> using namespace std; struct Card { char suit, value; }; void bubble(struct Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i; j--) { if (A[j].value < A[j - 1].value) { Card t = A[j]; A[j] = A[j - 1]; A[j - 1] = t; } } } } ...
#include <iostream> using namespace std; struct Card { char suit, value; }; void bubble(struct Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i; j--) { if (A[j].value < A[j - 1].value) { Card t = A[j]; A[j] = A[j - 1]; A[j - 1] = t; } } } } ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
491
2
#include <algorithm> #include <iostream> #include <stdio.h> #include <string> static const int MAX = 200000; using namespace std; struct Card { char suit, value; }; void trace(Card a[], int n) { for (int i = 0; i < n; i++) { if (i) cout << " "; cout << a[i].suit << a[i].value; } cout << endl; }...
#include <algorithm> #include <iostream> #include <stdio.h> #include <string> static const int MAX = 200000; using namespace std; struct Card { char suit, value; }; void trace(Card a[], int n) { for (int i = 0; i < n; i++) { if (i) cout << " "; cout << a[i].suit << a[i].value; } cout << endl; }...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
483
2
#include <algorithm> #include <iostream> #include <limits> #include <math.h> #include <numeric> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define in...
#include <algorithm> #include <iostream> #include <limits> #include <math.h> #include <numeric> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define in...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
537
2
#include <iostream> #include <vector> #define swap(type, x, y) \ do { \ type t = x; \ x = y; ...
#include <iostream> #include <vector> #define swap(type, x, y) \ do { \ type t = x; \ x = y; ...
[["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46]]
1
463
2
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; int main() { int N; string c1[36], c2[36]; cin >> N; for (int i = 0; i < N; i++) cin >> c1[i]; for (int i = 0; i < N; i++) c2[i] = c1[i]; for (int i = 0; i < N; i++) { for (int j = N - 1; j > i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; int main() { int N; string c1[36], c2[36]; cin >> N; for (int i = 0; i < N; i++) cin >> c1[i]; for (int i = 0; i < N; i++) c2[i] = c1[i]; for (int i = 0; i < N; i++) { for (int j = N - 1; j > i...
[["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
389
2
#include <iostream> #include <string> using namespace std; class Card { private: string type; //入力文字列 short number; // typeの番号 public: short order; //入力順番 void InputType(); // typeへ入力 void ChangeType(); // TypeをNumberへ変更 short GetNumber(); // number取得 string GetType(); }; void Copy(Card *tocard, Card...
#include <iostream> #include <string> using namespace std; class Card { private: string type; //入力文字列 short number; // typeの番号 public: short order; //入力順番 void InputType(); // typeへ入力 void ChangeType(); // TypeをNumberへ変更 short GetNumber(); // number取得 string GetType(); }; void Copy(Card *tocard, Card...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
728
4
// // Stable sort // // // Description: // // In the case when sorting cards by using // bubble sort and selection sort, bubble // sort can sort the cards correctly, but // selection sort sometimes fails to sort // them correctly. // // Complexity of is Stable: // // O(n) // #include <iost...
// // Stable sort // // // Description: // // In the case when sorting cards by using // bubble sort and selection sort, bubble // sort can sort the cards correctly, but // selection sort sometimes fails to sort // them correctly. // // Complexity of is Stable: // // O(n) // #include <iost...
[["-", 51, 16, 31, 118, 28, 69, 341, 342, 0, 22], ["+", 51, 16, 31, 118, 28, 69, 341, 342, 0, 22]]
1
499
2
#include <iostream> #include <string> #include <vector> using namespace std; struct Card { char suite; int num; }; vector<Card> selectionSort(vector<Card> A) { for (size_t i = 0; i < A.size() - 1; i++) { size_t minj = i; for (size_t k = i + 1; k < A.size(); k++) { if (A[k].num < A[minj].num) { ...
#include <iostream> #include <string> #include <vector> using namespace std; struct Card { char suite; int num; }; vector<Card> selectionSort(vector<Card> A) { for (size_t i = 0; i < A.size() - 1; i++) { size_t minj = i; for (size_t k = i + 1; k < A.size(); k++) { if (A[k].num < A[minj].num) { ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
664
2
#include <iostream> #define maxn 36 + 5 using namespace std; typedef struct Card { char Suit; char Value; } card; void BubbleSort(card *A, int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j > i; j--) { if (A[j].Value < A[j - 1].Value) { card temp = A[j]; A[j] = A[j - 1]; ...
#include <iostream> #define maxn 36 + 5 using namespace std; typedef struct Card { char Suit; char Value; } card; void BubbleSort(card *A, int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j > i; j--) { if (A[j].Value < A[j - 1].Value) { card temp = A[j]; A[j] = A[j - 1]; ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
445
2
#include "bits/stdc++.h" using namespace std; string bubbleSort(vector<char> &Mb, vector<int> &Nb, int A); string selectionSort(vector<char> &Ms, vector<int> &Ns, int A); int main(void) { int A; cin >> A; vector<char> M(A), Mb(A), Ms(A); vector<int> N(A), Nb(A), Ns(A); for (int i = 0; i < A; i++) cin ...
#include "bits/stdc++.h" using namespace std; string bubbleSort(vector<char> &Mb, vector<int> &Nb, int A); string selectionSort(vector<char> &Ms, vector<int> &Ns, int A); int main(void) { int A; cin >> A; vector<char> M(A), Mb(A), Ms(A); vector<int> N(A), Nb(A), Ns(A); for (int i = 0; i < A; i++) cin ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
811
2
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <numeric> #include <sstream> #include <string> #include <utility> #include <vector> using namespace std; void bubbleSort(vector<string> &a) { for (int i = 0; i < a.size(); i++) { for (int j = 0; j < ...
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <numeric> #include <sstream> #include <string> #include <utility> #include <vector> using namespace std; void bubbleSort(vector<string> &a) { for (int i = 0; i < a.size(); i++) { for (int j = 0; j < ...
[["-", 15, 339, 51, 16, 12, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 12, 2, 63, 118, 28, 22]]
1
473
2
#include <stdio.h> struct Card { char suit; int value; }; void bubbleSort(Card A[], int n) { for (int i = 0; i < n; i++) { for (int j = n - 1; j > i; j--) { int v = j - 1; if (A[j].value < A[v].value) { Card t = A[j]; A[j] = A[v]; A[v] = t; } } } for (int i...
#include <stdio.h> struct Card { char suit; int value; }; void bubbleSort(Card A[], int n) { for (int i = 0; i < n; i++) { for (int j = n - 1; j > i; j--) { int v = j - 1; if (A[j].value < A[v].value) { Card t = A[j]; A[j] = A[v]; A[v] = t; } } } for (int i...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
504
2
#include <bits/stdc++.h> using namespace std; struct { char suit; int num; } typedef Card; bool isStable(Card *a1, Card *a2, int n) { for (int i = 0; i < n; i++) { if (a1[i].suit != a2[i].suit) return false; } return true; } void printArray(Card *a, int n) { for (int i = 0; i < n; i++) { cou...
#include <bits/stdc++.h> using namespace std; struct { char suit; int num; } typedef Card; bool isStable(Card *a1, Card *a2, int n) { for (int i = 0; i < n; i++) { if (a1[i].suit != a2[i].suit) return false; } return true; } void printArray(Card *a, int n) { for (int i = 0; i < n; i++) { cou...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
497
2
#include <algorithm> #include <iostream> #include <vector> struct Card { char suit; int num; }; void printArray(std::vector<Card> cards) { int n = (int)cards.size(); for (int i = 0; i < n; i++) { std::cout << cards[i].suit << cards[i].num; if (i < n - 1) std::cout << " "; else std::cou...
#include <algorithm> #include <iostream> #include <vector> struct Card { char suit; int num; }; void printArray(std::vector<Card> cards) { int n = (int)cards.size(); for (int i = 0; i < n; i++) { std::cout << cards[i].suit << cards[i].num; if (i < n - 1) std::cout << " "; else std::cou...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
497
2
#include <cstdio> struct card { int value; char name; int num; int sc; }; int i, j; card a[120], b[120]; void bubblesort(int n) { for (i = 0; i < n; i++) for (j = n - 1; j >= i + 1; j--) { if (a[j - 1].value > a[j].value) { card temp; temp = a[j - 1]; a[j - 1] = a[j]; ...
#include <cstdio> struct card { int value; char name; int num; int sc; }; int i, j; card a[120], b[120]; void bubblesort(int n) { for (i = 0; i < n; i++) for (j = n - 1; j >= i + 1; j--) { if (a[j - 1].value > a[j].value) { card temp; temp = a[j - 1]; a[j - 1] = a[j]; ...
[["-", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
757
8
#include <iostream> using namespace std; int main() { int n, m, i, j, d1[36] = {}, d2[36] = {}; char t1[36] = {}, t2[36] = {}; cin >> n; for (i = 0; i < n; ++i) { cin >> t1[i] >> d1[i]; t2[i] = t1[i]; d2[i] = d1[i]; } for (i = 0; i < n; ++i) { for (j = n - 1; j > i; --j) { if (d1[j] <...
#include <iostream> using namespace std; int main() { int n, m, i, j, d1[36] = {}, d2[36] = {}; char t1[36] = {}, t2[36] = {}; cin >> n; for (i = 0; i < n; ++i) { cin >> t1[i] >> d1[i]; t2[i] = t1[i]; d2[i] = d1[i]; } for (i = 0; i < n; ++i) { for (j = n - 1; j > i; --j) { if (d1[j] <...
[["-", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["-", 8, 9, 0, 1, 0, 16, 12, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 16, 12, 69, 28, 22]]
1
421
4
#include <algorithm> #include <iostream> #include <math.h> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; struct card { int num; char val; }; int main() { int n; card bb[50], se[50]; cin >> n; for (int i = 0; i < n; i++) { char sss; in...
#include <algorithm> #include <iostream> #include <math.h> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; struct card { int num; char val; }; int main() { int n; card bb[50], se[50]; cin >> n; for (int i = 0; i < n; i++) { char sss; in...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
462
2
#include <cstdio> #include <iostream> #include <string> using namespace std; struct Card { char symbol; int number; }; void BubbleSort(Card *, int); void SelectionSort(Card *, int); void ShowData(Card *, int); bool isStable(Card *, Card *, int); int main(int argc, char const *argv[]) { int n; cin >> n; C...
#include <cstdio> #include <iostream> #include <string> using namespace std; struct Card { char symbol; int number; }; void BubbleSort(Card *, int); void SelectionSort(Card *, int); void ShowData(Card *, int); bool isStable(Card *, Card *, int); int main(int argc, char const *argv[]) { int n; cin >> n; C...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
593
2
#include <iostream> using namespace std; struct Card { char suit, value; }; void bubbleSort(struct Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i; j--) { if (A[j].value < A[j - 1].value) { struct Card tmp = A[j]; A[j] = A[j - 1]; A[j - 1] = tmp; ...
#include <iostream> using namespace std; struct Card { char suit, value; }; void bubbleSort(struct Card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i; j--) { if (A[j].value < A[j - 1].value) { struct Card tmp = A[j]; A[j] = A[j - 1]; A[j - 1] = tmp; ...
[["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]]
1
482
2
#include <bits/stdc++.h> using namespace std; #define ref goto refrain void bubble(int *a, char *c, int n); void selection(int *a, char *c, int n); int main() { int n; cin >> n; char suit[n], bs[n]; int num[n], bn[n], j; char dou[9][4]; //各数字のスーツの順番を記録 memset(dou, 'n', sizeof(dou)); for (int i = 0; i < ...
#include <bits/stdc++.h> using namespace std; #define ref goto refrain void bubble(int *a, char *c, int n); void selection(int *a, char *c, int n); int main() { int n; cin >> n; char suit[n], bs[n]; int num[n], bn[n], j; char dou[9][4]; //各数字のスーツの順番を記録 memset(dou, 'n', sizeof(dou)); for (int i = 0; i < ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
622
2
#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...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
529
2
#include <cstdio> #include <iostream> #include <utility> using namespace std; typedef struct { char c; int v; } cards; int main() { int n; cards x[36], y[36], z[36]; int count = 0; scanf(" %d", &n); for (int i = 0; i < n; ++i) { scanf(" %c %d", &x[i].c, &x[i].v); y[i] = x[i]; z[i] = x[i]; ...
#include <cstdio> #include <iostream> #include <utility> using namespace std; typedef struct { char c; int v; } cards; int main() { int n; cards x[36], y[36], z[36]; int count = 0; scanf(" %d", &n); for (int i = 0; i < n; ++i) { scanf(" %c %d", &x[i].c, &x[i].v); y[i] = x[i]; z[i] = x[i]; ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
453
2
#include <iostream> #include <vector> using namespace std; void BubbleSort(int N, vector<string> v) { int len = (int)v.size(); for (int i = 0; i < len - 1; i++) { for (int j = N - 1; j > i; j--) { if (v[j][1] < v[j - 1][1]) swap(v[j], v[j - 1]); } } for (int i = 0; i < len; i++) { ...
#include <iostream> #include <vector> using namespace std; void BubbleSort(int N, vector<string> &v) { int len = (int)v.size(); for (int i = 0; i < len - 1; i++) { for (int j = N - 1; j > i; j--) { if (v[j][1] < v[j - 1][1]) swap(v[j], v[j - 1]); } } for (int i = 0; i < len; i++) { ...
[["+", 49, 53, 54, 55, 0, 56, 49, 352, 0, 67]]
1
412
1
#include <iostream> #define rep(i, a) for (i = 0; i < a; i++) using namespace std; class Card { public: string suit; int value; void InputCard(string T); }; void Card::InputCard(string T) { suit = T[0]; value = T[1] - '0'; } void print(Card card[], int n) { int i; rep(i, n) { if (i > 0) { cou...
#include <iostream> #define rep(i, a) for (i = 0; i < a; i++) using namespace std; class Card { public: string suit; int value; void InputCard(string T); }; void Card::InputCard(string T) { suit = T[0]; value = T[1] - '0'; } void print(Card card[], int n) { int i; rep(i, n) { if (i > 0) { cou...
[["-", 12, 118, 28, 69, 341, 342, 0, 16, 31, 22], ["-", 12, 118, 28, 69, 341, 342, 0, 16, 17, 33], ["-", 12, 118, 28, 69, 341, 342, 0, 16, 12, 13], ["+", 51, 16, 12, 118, 28, 69, 341, 342, 0, 22]]
1
474
4
#include <algorithm> #include <bits/stdc++.h> #include <iterator> #include <vector> using namespace std; /** * vector<int>ar(3); * for(auto&e:ar){ * scanf("%d",&e); * } * sort(ar.begin(),ar.end()) * int sum=accumulate(ar.begin(),ar.end(),0); ***/ void vp(vector<string> x, int a) { for (int i = 0; i < a - ...
#include <algorithm> #include <bits/stdc++.h> #include <iterator> #include <vector> using namespace std; /** * vector<int>ar(3); * for(auto&e:ar){ * scanf("%d",&e); * } * sort(ar.begin(),ar.end()) * int sum=accumulate(ar.begin(),ar.end(),0); ***/ void vp(vector<string> x, int a) { for (int i = 0; i < a - ...
[["-", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6]]
1
472
49
#include <iostream> using namespace std; struct Card { char suit, value; }; void bubbleSort(struct Card c[], int n) { for (int i = 0; i < n; i++) { for (int k = n - 1; i < k; k--) { if (c[k].value < c[k - 1].value) { Card t = c[k]; c[k] = c[k - 1]; c[k - 1] = t; } } }...
#include <iostream> using namespace std; struct Card { char suit, value; }; void bubbleSort(struct Card c[], int n) { for (int i = 0; i < n; i++) { for (int k = n - 1; i < k; k--) { if (c[k].value < c[k - 1].value) { Card t = c[k]; c[k] = c[k - 1]; c[k - 1] = t; } } }...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
487
2
#include <functional> #include <iostream> #include <vector> using namespace std; namespace util { template <typename T> vector<T> read_vector(function<T(string)> parse_func) { int n; cin >> n; vector<T> v; for (int i = 0; i < n; i++) { string in; cin >> in; v.push_back(parse_func(in)); } retu...
#include <functional> #include <iostream> #include <vector> using namespace std; namespace util { template <typename T> vector<T> read_vector(function<T(string)> parse_func) { int n; cin >> n; vector<T> v; for (int i = 0; i < n; i++) { string in; cin >> in; v.push_back(parse_func(in)); } retu...
[["-", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
1,133
2
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; struct Card { char suit; int value; }; void babblesort(struct Card c[], int n) { bool flag = true; for (int i = 0; flag; i++) { flag = false; for (int j = n - 1; j >= i + 1; j--) { if (c[j].value < c[j - 1].value) { ...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; struct Card { char suit; int value; }; void babblesort(struct Card c[], int n) { bool flag = true; for (int i = 0; flag; i++) { flag = false; for (int j = n - 1; j >= i + 1; j--) { if (c[j].value < c[j - 1].value) { ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
524
2
#include <iostream> #include <utility> struct card { char suit, value; }; void bubbleSort(struct card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i; j--) { if (A[j].value < A[j - 1].value) std::swap(A[j], A[j - 1]); } } } void selectionSort(struct card A[], int N)...
#include <iostream> #include <utility> struct card { char suit, value; }; void bubbleSort(struct card A[], int N) { for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i; j--) { if (A[j].value < A[j - 1].value) std::swap(A[j], A[j - 1]); } } } void selectionSort(struct card A[], int N)...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
481
2
#include <iostream> using namespace std; struct Card { int num; char suit; }; void bubbleSort(Card c[], int N); void selectionSort(Card c[], int N); void swap(Card &x, Card &y); void showArray(Card c[], int N); bool Stable(Card x[], Card y[], int N); int main() { int N; Card c1[100], c2[100]; cin >> N; f...
#include <iostream> using namespace std; struct Card { int num; char suit; }; void bubbleSort(Card c[], int N); void selectionSort(Card c[], int N); void swap(Card &x, Card &y); void showArray(Card c[], int N); bool Stable(Card x[], Card y[], int N); int main() { int N; Card c1[36], c2[36]; cin >> N; for...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 7, 8, 7, 15, 16, 17, 20], ["+", 8, 9, 0, 7, 8, 7, 15, 16, 17, 47]]
1
521
6
#include <iostream> using namespace std; struct Card { char suit; int value; }; void selectionsort(struct Card A[], int N) { for (int i = 0; i < N; i++) { int minj = i; for (int j = i; j < N; j++) { if (A[j].value < A[minj].value) minj = j; } swap(A[i], A[minj]); } } void b...
#include <iostream> using namespace std; struct Card { char suit; int value; }; void selectionsort(struct Card A[], int N) { for (int i = 0; i < N; i++) { int minj = i; for (int j = i; j < N; j++) { if (A[j].value < A[minj].value) minj = j; } swap(A[i], A[minj]); } } void b...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
469
2
#include <iostream> using namespace std; struct Card { char suit, value; }; void BubbleSort(struct Card A[], int N); void SelectionSort(struct Card A[], int N); void print(struct Card A[], int N); bool isStable(struct Card A[], struct Card B[], int N); int main(void) { int N; Card A[100], B[100]; cin >> N; ...
#include <iostream> using namespace std; struct Card { char suit, value; }; void BubbleSort(struct Card A[], int N); void SelectionSort(struct Card A[], int N); void print(struct Card A[], int N); bool isStable(struct Card A[], struct Card B[], int N); int main(void) { int N; Card A[100], B[100]; cin >> N; ...
[["-", 15, 339, 51, 16, 12, 16, 12, 118, 119, 120], ["+", 15, 339, 51, 16, 12, 16, 12, 118, 119, 120]]
1
521
2
#include <iostream> using namespace std; struct Card { char suit; char value; }; void bubbleSort(Card A[], int N) { bool flag = true; int i = 1; while (flag) { flag = false; for (int j = N - 1; j >= i; j--) { if (A[j - 1].value > A[j].value) { Card temp = A[j]; A[j] = A[j - 1];...
#include <iostream> using namespace std; struct Card { char suit; char value; }; void bubbleSort(Card A[], int N) { bool flag = true; int i = 1; while (flag) { flag = false; for (int j = N - 1; j >= i; j--) { if (A[j - 1].value > A[j].value) { Card temp = A[j]; A[j] = A[j - 1];...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
728
2
// // ALDS1_2_C.cpp // // // Created by ?¢¨????????£??? on 2015/11/24. // // #include <iostream> #include <stdio.h> using namespace ::std; struct Card { char suit; char value; }; void checkStable(Card A1[], Card A2[], int N) { int stable_flg = 1; for (int i = 0; i < N; i++) { if (A1[i].suit != A2[i].s...
// // ALDS1_2_C.cpp // // // Created by ?¢¨????????£??? on 2015/11/24. // // #include <iostream> #include <stdio.h> using namespace ::std; struct Card { char suit; char value; }; void checkStable(Card A1[], Card A2[], int N) { int stable_flg = 1; for (int i = 0; i < N; i++) { if (A1[i].suit != A2[i].s...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
516
2
#include <algorithm> #include <iostream> using namespace std; class Card { public: int value; char mark; }; int main() { int n; cin >> n; Card c1[100], c2[100]; for (int i = 0; i < n; i++) { cin >> c1[i].mark >> c1[i].value; c2[i] = c1[i]; } // BubbleSort for (int i = 0; i < n; i++) { f...
#include <algorithm> #include <iostream> using namespace std; class Card { public: int value; char mark; }; int main() { int n; cin >> n; Card c1[100], c2[100]; for (int i = 0; i < n; i++) { cin >> c1[i].mark >> c1[i].value; c2[i] = c1[i]; } // BubbleSort for (int i = 0; i < n; i++) { f...
[["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
455
2
#include <iostream> using namespace std; #define MAX 36 int n; pair<char, int> card4Bubble[MAX]; pair<char, int> card4Selection[MAX]; void bubbleSort(); void selectionSort(); int main(void) { char type; int number; cin >> n; // input. for (int i = 0; i < n; i++) { cin >> type; cin >> number; ...
#include <iostream> using namespace std; #define MAX 40 int n; pair<char, int> card4Bubble[MAX]; pair<char, int> card4Selection[MAX]; void bubbleSort(); void selectionSort(); int main(void) { char type; int number; cin >> n; // input. for (int i = 0; i < n; i++) { cin >> type; cin >> number; ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 20], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 47]]
1
522
6
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; void print_vec(vector<string> &vec, int n) { for (int i = 0; i < n; i++) { cout << vec[i]; if (i < n - 1) cout << " "; } cout << endl; } int main() { int n; // number of entries; cin >> n; vec...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; void print_vec(vector<string> &vec, int n) { for (int i = 0; i < n; i++) { cout << vec[i]; if (i < n - 1) cout << " "; } cout << endl; } int main() { int n; // number of entries; cin >> n; v...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
421
2
#include <iostream> #include <utility> using namespace std; struct card { char suit; int value; }; void output(int n, card elements[]) { for (int i = 0; i < n - 1; i++) cout << elements[i].suit << elements[i].value << " "; cout << elements[n - 1].suit << elements[n - 1].value << endl; } int bubble_sort(...
#include <iostream> #include <utility> using namespace std; struct card { char suit; int value; }; void output(int n, card elements[]) { for (int i = 0; i < n - 1; i++) cout << elements[i].suit << elements[i].value << " "; cout << elements[n - 1].suit << elements[n - 1].value << endl; } int bubble_sort(...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
500
6
#include <algorithm> #include <iostream> using namespace std; struct Card { char suit; int num; }; void swapc(Card &c1, Card &c2); int main() { Card c1[36], c2[36]; int i, j, n, mini, tmpn; char tmpc, dum; bool flag; cin >> n; for (i = 0; i < n; i++) { cin.get(dum); cin.get(c1[i].suit); c...
#include <algorithm> #include <iostream> using namespace std; struct Card { char suit; int num; }; void swapc(Card &c1, Card &c2); int main() { Card c1[36], c2[36]; int i, j, n, mini, tmpn; char tmpc, dum; bool flag; cin >> n; for (i = 0; i < n; i++) { cin.get(dum); cin.get(c1[i].suit); c...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
465
2
#include <algorithm> #include <iostream> using namespace std; struct Card { int num; char type; }; void trace(int n, Card c[]) { for (int i = 0; i < n; ++i) { cout << c[i].type << c[i].num; if (i < n - 1) { cout << " "; } } cout << endl; } void bubbleSort(int n, Card c[]) { for (int i ...
#include <algorithm> #include <iostream> using namespace std; struct Card { int num; char type; }; void trace(int n, Card c[]) { for (int i = 0; i < n; ++i) { cout << c[i].type << c[i].num; if (i < n - 1) { cout << " "; } } cout << endl; } void bubbleSort(int n, Card c[]) { for (int i ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
436
2
#include <algorithm> #include <iostream> #include <vector> using namespace std; struct trump { int value; char suit; }; void print_trump(vector<trump> C, int N, bool is_stable) { for (int i = 0; i < N; i++) { cout << C[i].suit << C[i].value << (i + 1 == N ? "" : " "); } cout << endl; if (is_stable) { ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; struct trump { int value; char suit; }; void print_trump(vector<trump> C, int N, bool is_stable) { for (int i = 0; i < N; i++) { cout << C[i].suit << C[i].value << (i + 1 == N ? "" : " "); } cout << endl; if (is_stable) { ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
463
2
#include <iostream> #include <tuple> #include <utility> #include <vector> void DisplayCards(std::vector<std::tuple<char, int>> cards) { for (int i = 0; i < cards.size(); i++) { std::cout << std::get<0>(cards[i]) << std::get<1>(cards[i]); if (i != cards.size() - 1) { std::cout << " "; } else { ...
#include <iostream> #include <tuple> #include <utility> #include <vector> void DisplayCards(std::vector<std::tuple<char, int>> &cards) { for (int i = 0; i < cards.size(); i++) { std::cout << std::get<0>(cards[i]) << std::get<1>(cards[i]); if (i != cards.size() - 1) { std::cout << " "; } else { ...
[["+", 49, 53, 54, 55, 0, 56, 49, 352, 0, 67], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
678
3
// -*- mode:c++; coding:utf-8; indent-tabs-mode:nil; -*- // ALDS1_2-C #include <cstring> #include <iostream> struct card { char mark; unsigned int number; }; static void print_cards(const card cards[], const unsigned int n) { const char *sep = ""; for (unsigned int i = 0; i < n; ++i) { const card *const ...
// -*- mode:c++; coding:utf-8; indent-tabs-mode:nil; -*- // ALDS1_2-C #include <cstring> #include <iostream> struct card { char mark; unsigned int number; }; static void print_cards(const card cards[], const unsigned int n) { const char *sep = ""; for (unsigned int i = 0; i < n; ++i) { const card *const ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
498
2
// -*- mode:c++; coding:utf-8; c-basic-offset:2; -*- // ALDS1_2-C: Stable Sort #include <algorithm> #include <cstring> #include <iostream> struct Card { char suit; unsigned int rank; }; static void print_cards(const Card cards[], const unsigned int n) { const char *sep = ""; for (unsigned int i = 0u; i < n; ...
// -*- mode:c++; coding:utf-8; c-basic-offset:2; -*- // ALDS1_2-C: Stable Sort #include <algorithm> #include <cstring> #include <iostream> struct Card { char suit; unsigned int rank; }; static void print_cards(const Card cards[], const unsigned int n) { const char *sep = ""; for (unsigned int i = 0u; i < n; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
467
2
// -*- mode:c++; coding:utf-8; c-basic-offset:2; -*- // ALDS1_2-C: Stable Sort #include <algorithm> #include <cstring> #include <iostream> struct Card { char suit; unsigned int rank; bool operator<(const Card &rhs) const { return rank < rhs.rank; } bool operator==(const Card &rhs) const { return rank == r...
// -*- mode:c++; coding:utf-8; c-basic-offset:2; -*- // ALDS1_2-C: Stable Sort #include <algorithm> #include <cstring> #include <iostream> struct Card { char suit; unsigned int rank; bool operator<(const Card &rhs) const { return rank < rhs.rank; } bool operator!=(const Card &rhs) const { return rank != r...
[["-", 8, 123, 0, 14, 49, 53, 49, 366, 0, 60], ["+", 8, 123, 0, 14, 49, 53, 49, 366, 0, 79], ["-", 8, 9, 0, 37, 0, 16, 31, 16, 17, 60], ["+", 8, 9, 0, 37, 0, 16, 31, 16, 17, 79], ["-", 0, 14, 8, 9, 0, 37, 0, 16, 17, 98], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 106], ["-", 8, 9, 0, 37, 0, 16, 12, 16, 17, 60], ["+", 8, 9, 0...
1
618
10
#include <iostream> using namespace std; struct Card { char suit, value; }; //?????????????????????????????? void show_array(struct Card a[], int n) { for (int i = 0; i < n; i++) { if (i > 0) cout << " "; cout << a[i].suit << a[i].value; } cout << endl; } void BubbleSort(struct Card a[], int n)...
#include <iostream> using namespace std; struct Card { char suit, value; }; //?????????????????????????????? void show_array(struct Card a[], int n) { for (int i = 0; i < n; i++) { if (i > 0) cout << " "; cout << a[i].suit << a[i].value; } cout << endl; } void BubbleSort(struct Card a[], int n)...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
490
2
/* * c.cc: */ #include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <util...
/* * c.cc: */ #include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <util...
[["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
607
4
#include <iostream> #include <string> using namespace std; static const int MAX = 36; int main(void) { int N, minj; bool flag = true; string A[MAX], B[MAX]; cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; B[i] = A[i]; } //?????????????????? for (int i = 0; flag; i++) { flag = false; ...
#include <iostream> #include <string> using namespace std; static const int MAX = 36; int main(void) { int N, minj; bool flag = true; string A[MAX], B[MAX]; cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; B[i] = A[i]; } //?????????????????? for (int i = 0; flag; i++) { flag = false; ...
[["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
394
4
#include <algorithm> #include <iostream> #include <stdio.h> #define MAX 36 struct Card { char suit, value; }; void Bubble_sort(struct Card c[], int num) { bool flag = true; for (int i = 0; flag; i++) { flag = false; for (int j = num - 1; j >= i + 1; j--) { if (c[j].value < c[j - 1].value) { ...
#include <algorithm> #include <iostream> #include <stdio.h> #define MAX 36 struct Card { char suit, value; }; void Bubble_sort(struct Card c[], int num) { bool flag = true; for (int i = 0; flag; i++) { flag = false; for (int j = num - 1; j >= i + 1; j--) { if (c[j].value < c[j - 1].value) { ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
497
2
#include <iostream> using namespace std; struct Card { int value; char mark; }; //????????????????????????????????¨ void BubbleSort(Card A[], int n) { bool flag = 1; for (int i = 0; flag; i++) { flag = 0; for (int j = n - 1; j > i; j--) { if (A[j].value < A[j - 1].value) { Card c = A[j];...
#include <iostream> using namespace std; struct Card { int value; char mark; }; //????????????????????????????????¨ void BubbleSort(Card A[], int n) { bool flag = 1; for (int i = 0; flag; i++) { flag = 0; for (int j = n - 1; j > i; j--) { if (A[j].value < A[j - 1].value) { Card c = A[j];...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
463
2
#include <algorithm> #include <iostream> #include <vector> struct TCard { char Suit; int Num; bool operator==(const TCard &C) const { return Suit == C.Suit && Num == C.Num; } }; typedef std::vector<TCard> TList; TList Input() { int Count; std::cin >> Count; TList List(Count); for (int i = 0; i < Cou...
#include <algorithm> #include <iostream> #include <vector> struct TCard { char Suit; int Num; bool operator==(const TCard &C) const { return Suit == C.Suit && Num == C.Num; } }; typedef std::vector<TCard> TList; TList Input() { int Count; std::cin >> Count; TList List(Count); for (int i = 0; i < Cou...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
553
2
#include <algorithm> #include <iostream> using namespace std; struct card { char suit; int value; }; void bubbleSort(card c[], int n); void selectionSort(card c[], int n); bool isSame(card A[], card B[], int n); int main() { int n; cin >> n; card A[n], B[n]; for (int i = 0; i < n; i++) { cin >> A[i]...
#include <algorithm> #include <iostream> using namespace std; struct card { char suit; int value; }; void bubbleSort(card c[], int n); void selectionSort(card c[], int n); bool isSame(card A[], card B[], int n); int main() { int n; cin >> n; card A[n], B[n]; for (int i = 0; i < n; i++) { cin >> A[i]...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
647
2
package main import ( "fmt" "strconv" ) func main() { var n int fmt.Scan(&n) ss := make([]string, n) ns := make([]int, n) for i := 0; i < n; i++ { fmt.Scan(&ss[i]) ns[i], _ = strconv.Atoi(string(ss[i][1])) } ss2 := make([]string, n) ns2 := make([]int, n) copy(ss2, ss) copy(ns2, ns) for i := 0; i <...
package main import ( "fmt" "strconv" ) func main() { var n int fmt.Scan(&n) ss := make([]string, n) ns := make([]int, n) for i := 0; i < n; i++ { fmt.Scan(&ss[i]) ns[i], _ = strconv.Atoi(string(ss[i][1])) } ss2 := make([]string, n) ns2 := make([]int, n) copy(ss2, ss) copy(ns2, ns) for i := 0; i <...
[]
7
465
2
package main import ( "bufio" "fmt" "os" "reflect" "strconv" "strings" ) func main() { sc := bufio.NewScanner(os.Stdin) sc.Scan() length, _ := strconv.Atoi(sc.Text()) var inputSuits = make([]string, length) var inputNums = make([]int, length) var inputSuits2 = make([]string, length) var inputNums2 = make...
package main import ( "bufio" "fmt" "os" "reflect" "strconv" "strings" ) func main() { sc := bufio.NewScanner(os.Stdin) sc.Scan() length, _ := strconv.Atoi(sc.Text()) var inputSuits = make([]string, length) var inputNums = make([]int, length) var inputSuits2 = make([]string, length) var inputNums2 = make...
[["-", 75, 196, 0, 1, 0, 2, 3, 4, 0, 429], ["-", 0, 1, 0, 2, 3, 4, 0, 429, 0, 44], ["+", 75, 196, 0, 1, 0, 2, 3, 4, 0, 429], ["+", 0, 1, 0, 2, 3, 4, 0, 429, 0, 44]]
7
776
2
(function(input) { var p = input.split('\n').map(Number); var n = p.shift(); var a = p.slice(0, n); var count = 0; var g = []; for (var i = 0;; i++) { var m = Math.pow(3, i); if (m > a.length) { break; } g.unshift(m); } sortShell(a, g); console.log(g.length); console.log(g.join(' ')); console.log(count); co...
(function(input) { var p = input.split('\n').map(Number); var n = p.shift(); var a = p.slice(0, n); var count = 0; var g = []; for (var i = 0;; i++) { var m = Math.pow(4, i); if (m > a.length) { break; } g.unshift(m); } sortShell(a, g); console.log(g.length); console.log(g.join(' ')); console.log(count); co...
[["-", 0, 198, 0, 200, 51, 2, 3, 3, 0, 555], ["+", 0, 198, 0, 200, 51, 2, 3, 3, 0, 555], ["-", 0, 435, 8, 556, 0, 7, 567, 564, 17, 107], ["-", 0, 435, 8, 556, 0, 7, 567, 564, 12, 22], ["+", 0, 435, 8, 556, 0, 7, 567, 27, 17, 29]]
2
297
5
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int A[] = new int[n]; int i; for (i = 0; i < n; i++) { A[i] = sc.nextInt(); } shellSort(A, n); for (i = 0; i < n; i++) { System.out.pr...
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int A[] = new int[n]; int i; for (i = 0; i < n; i++) { A[i] = sc.nextInt(); } shellSort(A, n); for (i = 0; i < n; i++) { System.out.pr...
[["-", 8, 196, 0, 7, 15, 16, 12, 16, 17, 85], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
421
2
// ALDS1_2_D Shell Sort import java.io.*; class Main { public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { int n = Integer.parseInt(br.readLine()); int[] A = new int[n]; for (int i = 0; i < n; i++) { A[i] = Intege...
// ALDS1_2_D Shell Sort import java.io.*; class Main { public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { int n = Integer.parseInt(br.readLine()); int[] A = new int[n]; for (int i = 0; i < n; i++) { A[i] = Intege...
[["-", 0, 195, 8, 196, 0, 7, 26, 11, 17, 32], ["-", 0, 7, 26, 11, 12, 16, 31, 16, 31, 22], ["-", 0, 7, 26, 11, 12, 16, 31, 16, 17, 48], ["-", 0, 7, 26, 11, 12, 16, 31, 16, 12, 499], ["-", 8, 196, 0, 7, 26, 11, 12, 16, 17, 72], ["-", 8, 196, 0, 7, 26, 11, 12, 16, 12, 499], ["+", 0, 195, 8, 196, 0, 7, 26, 27, 0, 29]]
3
440
7
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int cnt; int m =...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int cnt; int m = ...
[["+", 3, 4, 0, 504, 71, 16, 31, 23, 0, 24], ["+", 0, 504, 71, 16, 31, 23, 0, 16, 31, 22], ["+", 0, 504, 71, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 504, 71, 16, 31, 23, 0, 16, 12, 499], ["+", 3, 4, 0, 504, 71, 16, 31, 23, 0, 25], ["+", 0, 492, 3, 4, 0, 504, 71, 16, 17, 33]]
3
436
6
#include <bits/stdc++.h> using namespace std; bool judge(void); int N; int i, j; int X[36], Y[36]; char x[36], y[36]; bool judge() { int i; for (i = 0; i < N; i++) { if (x[i] == y[i] && X[i] == Y[i]) { continue; } else { return 0; break; } } return 1; } int main() { int tmp, ...
#include <bits/stdc++.h> using namespace std; bool judge(void); int N; int i, j; int X[36], Y[36]; char x[36], y[36]; bool judge() { int i; for (i = 0; i < N; i++) { if (x[i] == y[i] && X[i] == Y[i]) { continue; } else { return 0; break; } } return 1; } int main() { int tmp, ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
465
2
#include <algorithm> #include <iostream> #include <sstream> #include <string> #include <utility> #include <vector> using namespace std; typedef vector<pair<char, int>> Trump; namespace { void BubbleSort(Trump &t, int N) { bool flag = true; while (flag) { flag = false; for (int i = N - 1; i > 0; --i) ...
#include <algorithm> #include <iostream> #include <sstream> #include <string> #include <utility> #include <vector> using namespace std; typedef vector<pair<char, int>> Trump; namespace { void BubbleSort(Trump &t, int N) { bool flag = true; while (flag) { flag = false; for (int i = N - 1; i > 0; --i) ...
[["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
467
2
#include <iostream> using namespace std; #include <string> class card { public: char c, suit; int value; card(); void input(); }; card::card() {} void card::input() { cin >> suit >> c; value = c - '0'; } void show(card *a, int n) { for (int i = 0; i < n - 1; i++) cout << a[i].suit << a[i].value <<...
#include <iostream> using namespace std; class card { public: char c, suit; int value; card(); void input(); }; card::card() {} void card::input() { cin >> suit >> c; value = c - '0'; } void show(card *a, int n) { for (int i = 0; i < n - 1; i++) cout << a[i].suit << a[i].value << " "; cout << a[...
[["-", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["-", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
527
4
#include <iostream> using namespace std; const int MAX = 36; int N; pair<char, int> arr_bubble[MAX]; pair<char, int> arr_selection[MAX]; void bubble_sort(); void selection_sort(); int main() { char type; int number; cin >> N; for (int i = 0; i < N; i++) { cin >> type; cin >> number; arr_bubb...
#include <iostream> using namespace std; const int MAX = 36; int N; pair<char, int> arr_bubble[MAX]; pair<char, int> arr_selection[MAX]; void bubble_sort(); void selection_sort(); int main() { char type; int number; cin >> N; for (int i = 0; i < N; i++) { cin >> type; cin >> number; arr_bubb...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
536
2
#include <iostream> using namespace std; void bubblesort(char Cp1[], char Cp2[], int N); void selectionsort(char Cp1[], char Cp2[], int N); bool isStable(char Cp1[], char Cp2[], int N); int main() { int N; cin >> N; char *Cp1 = new char[N]; char *Cp2 = new char[N]; char *Cp3 = new char[N]; char *Cp4 = new...
#include <iostream> using namespace std; void bubblesort(char Cp1[], char Cp2[], int N); void selectionsort(char Cp1[], char Cp2[], int N); bool isStable(char Cp1[], char Cp2[], int N); int main() { int N; cin >> N; char *Cp1 = new char[N]; char *Cp2 = new char[N]; char *Cp3 = new char[N]; char *Cp4 = new...
[["-", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
569
2