Previous12345???NextFilterReset
Username

1504054_nahid
Prob
	Result 
	Time
(ms)	Mem
(MB)	Lang 
	Submit Time
1504054_nahid
A
Accepted
68	1.7	
C++
26 days ago
1504054_nahid
A
Wrong Answer
C++
26 days ago
1504054_nahid
E
Wrong Answer
C++
27 days ago
1504054_nahid
E
Compilation error
C++
27 days ago
1504054_nahid
G
Accepted
0	3.2	
C++
27 days ago
1504054_nahid
N
Accepted
1170	7.1	
C++
27 days ago
1504054_nahid
A
Wrong Answer
C++
27 days ago
1504054_nahid
A
Wrong Answer
C++
27 days ago
1504054_nahid
A
Wrong Answer
C++
27 days ago
1504054_nahid
J
Accepted
0	3.2	
C++
27 days ago
1504054_nahid
I
Accepted
0	3.2	
C++
27 days ago
1504054_nahid
I
Presentation Error
C++
27 days ago
1504054_nahid
I
Presentation Error
C++
27 days ago
1504054_nahid
I
Presentation Error
C++
27 days ago

All Copyright Reserved ??2010-2017 Xu Han 
Server Time: 2017-12-01 14:31:25 BST

#11410813 | 1504054_nahid's solution for [Aizu-ALDS1_2_B] [Problem J]
Status
Accepted
Memory
3224kB
Length
561
Lang
C++14
Submitted
2017-11-04 20:17:01
Shared

RemoteRunId
2593420
10.0 / 10.0
Select Code
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,cnt=0,min;
    scanf("%d",&n);
    int arr[n];
    for(int i=0;i<n;i++)
    scanf("%d",&arr[i]);
     for(int i=0;i<n-1;i++)
       {
         min=i;
         for(int j=i+1;j<n;j++)
         {
             if(arr[j]<arr[min])
             {

                 min=j;
                 //cnt++;
             }
         }
        if(i!=min)
        {swap(arr[min],arr[i]);
         cnt++;
}
         }
 for(int i=0;i<n-1;i++)
    printf("%d ",arr[i]);
printf("%d\n",arr[n-1]);
 printf("%d\n",cnt);
}