Submission #845519
Source Code Expand
Copy
#include <cstdio> #include <algorithm> #include <cassert> #include <map> using namespace std; const int N = 1000500; typedef long long llong; int A[N]; int X[N]; int Y[N]; int main() { int n; scanf("%d", &n); int ans = 0; map<int, int> M; for (int i = 0; i < n; i++) { scanf("%d", &A[i]); M[A[i]]; } int pt = 0; for (map<int, int>::iterator it = M.begin(); it != M.end(); it++) it->second = pt++; for (int i = 0; i < n; i++) { A[i] = M[A[i]]; X[i] = A[i] % 2; Y[i] = i % 2; ans += X[i] != Y[i]; } assert(ans % 2 == 0); printf("%d\n", ans / 2); }
Submission Info
Submission Time | |
---|---|
Task | C - BBuBBBlesort! |
User | Zlobober |
Language | C++14 (GCC 5.4.1) |
Score | 600 |
Code Size | 687 Byte |
Status | AC |
Exec Time | 146 ms |
Memory | 6144 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:15:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^ ./Main.cpp:19:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &A[i]); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 600 / 600 | ||||
Status |
|
|
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 | 136 ms | 6144 KB |
02.txt | AC | 145 ms | 6144 KB |
03.txt | AC | 137 ms | 6144 KB |
04.txt | AC | 144 ms | 6144 KB |
05.txt | AC | 125 ms | 6144 KB |
06.txt | AC | 136 ms | 6144 KB |
07.txt | AC | 138 ms | 6144 KB |
08.txt | AC | 84 ms | 6144 KB |
09.txt | AC | 85 ms | 6144 KB |
10.txt | AC | 85 ms | 6144 KB |
11.txt | AC | 86 ms | 6144 KB |
12.txt | AC | 83 ms | 6144 KB |
13.txt | AC | 80 ms | 6144 KB |
14.txt | AC | 146 ms | 6144 KB |
15.txt | AC | 127 ms | 6144 KB |
16.txt | AC | 140 ms | 6144 KB |
17.txt | AC | 122 ms | 6144 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 |