Language: C

#include <stdio.h>
 
int main() {
  int n;
  int i,j,e;
  int a[101],b[101];
  int t,minj,flag;
  char c[101],kara,m,d[101],f[4];
  char str[3];
  int sta = 0;
 
  scanf("%d", &n);
 
  for(i=0; i<n; i++) {
 
    scanf("%s",str);
    c[i] = str[0];
    a[i]  = str[1] - '0';
    //    printf("%c %d\n",c[i],a[i]);
    b[i] = a[i];
    d[i] = c[i];
 
  }
 
 
 
  //Bubble Sort
 
  for(i = 0; i<=n-1;i++) {
    for(j = 0; j<=n-1;j++) {
 
      if(a[j] < a[j-1]) {
 
    t = a[j];
    a[j] = a[j-1];
    a[j-1] = t;
 
    m = c[j];
    c[j] = c[j-1];
    c[j-1] = m;
      }
    }
  }
 
  for(i = 0;i<n;i++) {
 
    printf("%c%d",c[i],a[i]);
     
    if(i != n-1) printf(" ");
 
  }
 
  printf("\nStable\n");
 
 
 
 
  // Selsection Sort
 
   
 
  for(i = 0; i<=n-1; i++) {
    minj = i;
    flag = 0;
   
    for(j = i; j<=n-1;j++) {
      if(b[j] < b[minj]) {
    //  printf("%d < %d\n",b[j],b[minj]);
    minj = j;
    //printf("minj = %d\n",b[minj]);
    flag = 1;
      }
    }
 
     
 
    if(flag == 1) {
 
 
      t = b[i];
      b[i] = b[minj];
      b[minj] = t;
 
      m = d[i];
      d[i] = d[minj];
      d[minj] = m;
   
    }
  }
 
    
  for(i=0;i<n;i++) {
     printf("%c%d",d[i],b[i]);
    if(i != n-1) {
      printf(" ");
    }
 
  }
 
 
printf("\n");
flag = 0;
for(j=0;j<n;j++){
 
  //printf("c[%d](%c) = d[%d](%c)\n",j,c[j],j,d[j]);
 
  if(c[j] != d[j]) {
    flag = 1;
    
  }
 } 
 
if(flag == 1) printf("Not stable\n");
 else printf("Stable\n");
 
 return 0;
 
}

Compile Error Logs:

ステータス
Judge: 10/10	C	CPU: 00:00 sec	Memory: 616 KB	Length: 1414 B	2015-05-16 18:38
テストケースの判定結果
Case #	Verdict	CPU Time	Memory	In	Out	Case Name
Case #1	: Accepted	00:00	612	17	48	testcase_00
Case #2	: Accepted	00:00	612	8	26	testcase_01
Case #3	: Accepted	00:00	608	8	26	testcase_02
Case #4	: Accepted	00:00	612	17	44	testcase_03
Case #5	: Accepted	00:00	608	29	72	testcase_04
Case #6	: Accepted	00:00	612	111	234	testcase_05
Case #7	: Accepted	00:00	616	111	234	testcase_06
Case #8	: Accepted	00:00	612	111	234	testcase_07
Case #9	: Accepted	00:00	612	111	234	testcase_08
Case #10	: Accepted	00:00	612	111	234	testcase_09

< prev |		/		| next >	 		
 
Judge Input #  ( | )		Judge Output #  ( | )
 
	  	
 

Aizu Online Judge
follow us on Twitter


About us
ContactSystem InfoThe University of AizuUniv. of Aizu Competitive Programming Club

Tools
WEB Board ToolsVirtual ArenaAPI Reference
Links
ACM/ICPCACM/ICPC Asia JapanACM-ICPC OB/OG Alumni GroupPC KoshienJOI

AtCoderTopCoderCodeForces

Uva Online judgesACM-ICPC Live ArchivePKU JudgeOnline

Best viewed using Firefox, Google ChromeAizu Online Judge Version 1.0 © 2004 - 2016 Univ. of Aizu Competitive Programming Club (ICPCPC), Database Systems Lab. University of Aizu
 


Compiler output:
main.c:120:1: error: unknown type name 'Compile'
  120 | Compile Error Logs:
      | ^~~~~~~
main.c:120:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Logs'
  120 | Compile Error Logs:
      |               ^~~~
main.c:125:6: error: stray '#' in program
  125 | Case #  Verdict CPU Time        Memory  In      Out     Case Name
      |      ^
main.c:126:6: error: stray '#' in program
  126 | Case #1 : Accepted      00:00   612     17      48      testcase_00
      |      ^
main.c:127:6: error: stray '#' in program
  127 | Case #2 : Accepted      00:00   612     8       26      testcase_01
      |      ^
main.c:128:6: error: stray '#' in program
  128 | Case #3 : Accepted      00:00   608     8       26      testcase_02
      |      ^
main.c:129:6: error: stray '#' in program
  129 | Case #4 : Accepted      00:00   612     17      44      testcase_03
      |      ^
main.c:130:6: error: stray '#' in program
  130 | Case #5 : Accepted      00:00   608     29      72      testcase_04
      |      ^
main.c:131:6: error: stray '#' in program
  131 | Case #6 : Accepted      00:00   612     111     234     testcase_05
      |      ^
main.c:132:6: error: stray '#' in program
  132 | Case #7 : Accepted      00:00   616     111     234     testcase_06
      |      ^
main.c:133:6: error: stray '#' in program
  133 | Case #8 : Accepted      00:00   612     111     234     testcase_07
      |      ^
main.c:134:6: error: stray '#' in program
  134 | Case #9 : Accepted      00:00   612     111     234     testcase_08
      |      ^
main.c:135:6: error: stray '#' in program
  135 | Case #10        : Accepted      00:00   612     111     234     testcase_09
      |      ^
main.c:139:13: error: stray '#' in program
  139 | Judge Input #  ( | )            Judge Output #  ( | )
      |             ^
main.c:139:46: error: stray '#' in program
  139 | Judge Input #  ( | )            Judge Output #  ( | )
      |                                              ^
main.c:160:71: error: stray '\302' in program
  160 | Best viewed using Firefox, Google ChromeAizu Online Judge Version 1.0 <U+00A9> 2004 - 2016 Univ. of Aizu Competitive Programming Club (ICPCPC), Database Systems Lab. University of Aizu
      |                                                                       ^~~~~~~~