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

Submission #845200

Source Code Expand

Copy
// tested by Hightail: https://github.com/dj3500/hightail
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stack>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <cassert>
using namespace std;
#define pb push_back
#define INF 1001001001
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define mp make_pair
#define pii pair<int,int>
#define ll long long
#define vi vector<int>
#define SZ(x) ((int)((x).size()))
#define fi first
#define se second
#define wez(n) int (n); scanf("%d",&(n));
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
inline void pisz(int n) { printf("%d\n",n); }
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){FOR(i,SZ(t))s<<t[i]<<" ";return s; }
#define DBG(vari) cout<<"["<<__LINE__<<"] "<<#vari<<" = "<<(vari)<<endl;
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (__typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define TESTS wez(testow)while(testow--)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define IOS ios_base::sync_with_stdio(0);

int main () {
vector<pii> v;
wez(n);
FOR(i,n) {
wez(x);
v.pb(mp(x,i));
}
sort(ALL(v));
int res = 0;
FOR(i,n) {
if ((i % 2) != (v[i].se % 2)) ++res;
}
cout << res / 2;
}

#### Submission Info

Submission Time 2016-08-21 21:12:56+0900 C - BBuBBBlesort! dj3500 C++14 (GCC 5.4.1) 600 1798 Byte AC 41 ms 1400 KB

#### Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:29:41: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
#define wez(n) int (n); scanf("%d",&(n));
^
./Main.cpp:47:4: note: in expansion of macro ‘wez’
wez(n);
^
./Main.cpp:29:41: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
#define wez(n) int (n); scanf("%d",&(n));
^
./Main.cpp:49:7: note: in expansion of macro ‘wez’
wez(x);
^

#### 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 40 ms 1400 KB
02.txt AC 40 ms 1400 KB
03.txt AC 41 ms 1400 KB
04.txt AC 41 ms 1400 KB
05.txt AC 36 ms 1400 KB
06.txt AC 36 ms 1400 KB
07.txt AC 36 ms 1400 KB
08.txt AC 28 ms 1400 KB
09.txt AC 27 ms 1400 KB
10.txt AC 27 ms 1400 KB
11.txt AC 26 ms 1400 KB
12.txt AC 26 ms 1400 KB
13.txt AC 27 ms 1400 KB
14.txt AC 36 ms 1400 KB
15.txt AC 37 ms 1400 KB
16.txt AC 36 ms 1400 KB
17.txt AC 36 ms 1400 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