Language: C

  #include<stdio.h>
typedef struct{
  char sign;
  int value;
}Card;
void BubbleSort(Card*,int);
void SelectionSort(Card*,int);
int isStable(Card*,Card*,int);
void output(Card*,int,int);
 
int main()
{
  Card a[36],b[36];
  int i,j,n;
 
  scanf("%d",&n);
  for(i=0; i<n; i++) {
    scanf(" %c%d",&a[i].sign,&a[i].value);
    b[i] = a[i];
  }
 
  BubbleSort(a,n);
  SelectionSort(b,n);
  output(a,n,0);
  output(b,n,isStable(b,a,n));
 
  return 0;
}
   
void BubbleSort(Card a[],int n)
{
  int i,j;
  Card tmp;
 
  for(i=0; i<n; i++) 
    for(j=n-1; j>i; j--) 
      if(a[j].value < a[j-1].value){
    tmp = a[j];
    a[j] = a[j-1];
    a[j-1] = tmp;
      }
}
 
void SelectionSort(Card b[],int n)
{
  int i,j,minj;
  Card tmp;
 
  for(i=0; i<n-1; i++) {
    minj = i;
    for(j=i; j<n; j++) 
      if(b[j].value < b[minj].value) minj = j;
    if(minj != i) {
      tmp = b[i];
      b[i] = b[minj];
      b[minj] = tmp;
    }
  }
}
 
int isStable(Card in[],Card out[],int n) 
{
  int i,j,a,b;
  for(i=0; i<n; i++) 
    for(j=i+1; j<n; j++)
      for(a=0; a<n; a++)
    for(b=a+1; b<n; b++)
      if(in[i].value == in[j].value && in[i].sign == out[b].sign && in[j].sign == out[a].sign && in[i].value == out[b].value && in[j].value == out[a].value)
        return 1;
  return 0;
}
 
void output(Card a[], int n,int result)
{
  int i;
   
  for(i=0; i<n; i++) {
    printf("%c%d",a[i].sign,a[i].value);
    if(i<n-1) printf(" ");
  }
  if(!result) printf("\nStable\n");
  else printf("\nNot stable\n");
}
Compile Error Logs:
You are not authorized to see the message.

???????????????
Judge: 10/10 	C 	CPU: 00.00 sec 	Memory: 612 KB 	Length: 1473 B 	2016-04-22 13:31 	2016-04-22 13:31
???????????±?????????????????????
Case # 	Verdict 	CPU Time 	Memory 	In 	Out 	Case Name
Case #1: 	: Accepted 	00.00 sec 	612 KB 	17 B 	48 B 	test_case_1
Case #2: 	: Accepted 	00.00 sec 	612 KB 	8 B 	26 B 	test_case_2
Case #3: 	: Accepted 	00.00 sec 	612 KB 	8 B 	26 B 	test_case_3
Case #4: 	: Accepted 	00.00 sec 	612 KB 	17 B 	44 B 	test_case_4
Case #5: 	: Accepted 	00.00 sec 	612 KB 	29 B 	72 B 	test_case_5
Case #6: 	: Accepted 	00.00 sec 	612 KB 	111 B 	234 B 	test_case_6
Case #7: 	: Accepted 	00.00 sec 	612 KB 	111 B 	234 B 	test_case_7
Case #8: 	: Accepted 	00.00 sec 	612 KB 	111 B 	234 B 	test_case_8
Case #9: 	: Accepted 	00.00 sec 	612 KB 	111 B 	234 B 	test_case_9
Case #10: 	: Accepted 	00.00 sec 	612 KB 	111 B 	234 B 	test_case_10
< prev | 	1 	/ 	10 	| next > 	  		 : Accepted        00.00 sec        612 KB
 
Judge Input #1 ( in1.txt | 17 B) 		Judge Output #1 ( out1.txt | 48 B)

5
H4 C9 S4 D2 C3

		

D2 C3 H4 S4 C9
Stable
D2 C3 S4 H4 C9
Not stable

Comments
 
 ??\????????§??????
 
Categories
 
 
Free Tags
 
 
 
	   	
 

Aizu Online Judge
follow us on Twitter

About us

ContactSystem InfoThe University of AizuUniv. of Aizu Competitive Programming Club
Tools

WEB Board ToolsVirtual ArenaAPI ReferenceTutorial
Links

ACM/ICPCACM/ICPC Asia JapanACM-ICPC OB/OG Alumni GroupPC KoshienJOI

AtCoderTopCoderCodeForces

Uva Online judgesACM-ICPC Live ArchivePKU JudgeOnline

Aizu IT Arena

Best viewed using Firefox, Google Chrome

Aizu Online Judge Version 1.0 ?? 2004 - 2016 Univ. of Aizu Competitive Programming Club (ICPCPC), Database Systems Lab. University of Aizu
 

Compiler output:
main.c:84:1: error: unknown type name 'Compile'
   84 | Compile Error Logs:
      | ^~~~~~~
main.c:84:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Logs'
   84 | Compile Error Logs:
      |               ^~~~
main.c:89:12: error: stray '\302' in program
   89 | ???????????<U+00B1>?????????????????????
      |            ^~~~~~~~
main.c:90:6: error: stray '#' in program
   90 | Case #  Verdict         CPU Time        Memory  In      Out     Case Name
      |      ^
main.c:91:6: error: stray '#' in program
   91 | Case #1:        : Accepted      00.00 sec       612 KB  17 B    48 B    test_case_1
      |      ^
main.c:92:6: error: stray '#' in program
   92 | Case #2:        : Accepted      00.00 sec       612 KB  8 B     26 B    test_case_2
      |      ^
main.c:93:6: error: stray '#' in program
   93 | Case #3:        : Accepted      00.00 sec       612 KB  8 B     26 B    test_case_3
      |      ^
main.c:94:6: error: stray '#' in program
   94 | Case #4:        : Accepted      00.00 sec       612 KB  17 B    44 B    test_case_4
      |      ^
main.c:95:6: error: stray '#' in program
   95 | Case #5:        : Accepted      00.00 sec       612 KB  29 B    72 B    test_case_5
      |      ^
main.c:96:6: error: stray '#' in program
   96 | Case #6:        : Accepted      00.00 sec       612 KB  111 B   234 B   test_case_6
      |      ^
main.c:97:6: error: stray '#' in program
   97 | Case #7:        : Accepted      00.00 sec       612 KB  111 B   234 B   test_case_7
      |      ^
main.c:98:6: error: stray '#' in program
   98 | Case #8:        : Accepted      00.00 sec       612 KB  111 B   234 B   test_case_8
      |      ^
main.c:99:6: error: stray '#' in program
   99 | Case #9:        : Accepted      00.00 sec       612 KB  111 B   234 B   test_case_9
      |      ^
main.c:100:6: error: stray '#' in program
  100 | Case #10:       : Accepted      00.00 sec       612 KB  111 B   234 B   test_case_10
      |      ^
main.c:103:13: error: stray '#' in program
  103 | Judge Input #1 ( in1.txt | 17 B)                Judge Output #1 ( out1.txt | 48 B)
      |             ^
main.c:103:62: error: stray '#' in program
  103 | Judge Input #1 ( in1.txt | 17 B)                Judge Output #1 ( out1.txt | 48 B)
      |                                                              ^
main.c:117:4: error: stray '\' in program
  117 |  ??\????????§??????
      |    ^
main.c:117:13: error: stray '\302' in program
  117 |  ??\????????<U+00A7>??????
      |             ^~~~~~~~