Submission #844912


Source Code Expand

Copy
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
VI mar;
map<in,in> ps;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n;
  cin>>n;
  in sm=0;
  mar.resize(n);
  forn(i,n){
    cin>>mar[i];
    ps[mar[i]]=0;
  }
  in ct=0;
  fors(i,ps)
    i->second=ct++;
  forn(i,n)
    if(i%2!=ps[mar[i]]%2)
      ++sm;
  sm/=2;
  cout<<sm<<endl;
  return 0;
}

Submission Info

Submission Time
Task C - BBuBBBlesort!
User w4yneb0t
Language C++14 (GCC 5.4.1)
Score 600
Code Size 799 Byte
Status AC
Exec Time 126 ms
Memory 7296 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 124 ms 7296 KB
02.txt AC 123 ms 7296 KB
03.txt AC 126 ms 7296 KB
04.txt AC 125 ms 7296 KB
05.txt AC 118 ms 7296 KB
06.txt AC 117 ms 7296 KB
07.txt AC 118 ms 7296 KB
08.txt AC 96 ms 7296 KB
09.txt AC 96 ms 7296 KB
10.txt AC 97 ms 7296 KB
11.txt AC 98 ms 7296 KB
12.txt AC 99 ms 7296 KB
13.txt AC 99 ms 7296 KB
14.txt AC 119 ms 7296 KB
15.txt AC 118 ms 7296 KB
16.txt AC 119 ms 7296 KB
17.txt AC 118 ms 7296 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