Contest Duration: - (local time) (110 minutes) Back to Home

Submission #845342

Source Code Expand

Copy
```#include <bits/stdc++.h>

#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using namespace std;

using pii=pair<int,int>;
pii ary[100010];

int main(void){
int n;
cin >> n;
rep(i,n) cin >> ary[i].first,ary[i].second=i;
sort(ary,ary+n);

int ans=0;
rep(i,n) if(i%2!=ary[i].second%2) ans++;
cout << ans/2 << endl;
return 0;
}```

#### Submission Info

Submission Time 2016-08-21 21:14:58+0900 C - BBuBBBlesort! Hec C++14 (GCC 5.4.1) 600 1110 Byte AC 94 ms 1024 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
 AC × 2
 AC × 24
Set Name Test Cases
Sample s1.txt, s2.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, s1.txt, s2.txt
Case Name Status Exec Time Memory
01.txt AC 94 ms 1024 KB
02.txt AC 94 ms 1024 KB
03.txt AC 94 ms 1024 KB
04.txt AC 94 ms 1024 KB
05.txt AC 75 ms 1024 KB
06.txt AC 74 ms 1024 KB
07.txt AC 73 ms 1024 KB
08.txt AC 65 ms 1024 KB
09.txt AC 65 ms 1024 KB
10.txt AC 65 ms 1024 KB
11.txt AC 66 ms 1024 KB
12.txt AC 66 ms 1024 KB
13.txt AC 70 ms 1024 KB
14.txt AC 73 ms 1024 KB
15.txt AC 74 ms 1024 KB
16.txt AC 74 ms 1024 KB
17.txt AC 75 ms 1024 KB
18.txt AC 4 ms 256 KB
19.txt AC 4 ms 256 KB
20.txt AC 4 ms 256 KB
21.txt AC 4 ms 256 KB
22.txt AC 4 ms 256 KB
s1.txt AC 4 ms 256 KB
s2.txt AC 4 ms 256 KB