Submission #847846


Source Code Expand

Copy
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
int a[SIZE];
map<int,int>H;
int main(){
   DRI(N);
 REP(i,N){RI(a[i]);H[a[i]]=i&1;}
 sort(a,a+N);
 int an=0;
 REP(i,N)an+=H[a[i]]^(i&1);
 cout<<an/2<<endl;
 return 0;
}

Submission Info

Submission Time
Task C - BBuBBBlesort!
User dreamoon
Language C++14 (GCC 5.4.1)
Score 600
Code Size 1247 Byte
Status AC
Exec Time 109 ms
Memory 5376 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:33:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    DRI(N);
          ^
./Main.cpp:34:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  REP(i,N){RI(a[i]);H[a[i]]=i&1;}
                   ^

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 107 ms 5376 KB
02.txt AC 109 ms 5376 KB
03.txt AC 107 ms 5376 KB
04.txt AC 107 ms 5376 KB
05.txt AC 102 ms 5376 KB
06.txt AC 103 ms 5376 KB
07.txt AC 104 ms 5376 KB
08.txt AC 78 ms 5376 KB
09.txt AC 78 ms 5376 KB
10.txt AC 79 ms 5376 KB
11.txt AC 79 ms 5376 KB
12.txt AC 77 ms 5376 KB
13.txt AC 77 ms 5376 KB
14.txt AC 102 ms 5376 KB
15.txt AC 103 ms 5376 KB
16.txt AC 101 ms 5376 KB
17.txt AC 103 ms 5376 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