Submission #844838
Source Code Expand
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <deque>
#include <queue>
#include <cstring>
#include <set>
#include <list>
#include <map>
#include <random>
#include <unordered_map>
#include <stdio.h>
using namespace std;
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<bool> vb;
typedef std::vector<string> vs;
typedef std::vector<double> vd;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<int> > vvi;
typedef vector<vvi> vvvi;
typedef vector<vll> vvll;
typedef std::vector<std::pair<int, int> > vpi;
typedef vector<vpi> vvpi;
typedef std::pair<int, int> pi;
typedef std::pair<ll, ll> pll;
typedef std::vector<pll> vpll;
const long long mod = 1000000007;
#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define forn(i, a, b) for(int i = a; i < b; i++)
#define pb push_back
#define mp make_pair
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
#endif
int n;
cin>>n;
vi a(n);
vpi b;
forn(i,0,n) {
cin>>a[i];
b.pb(mp(a[i], i));
}
sort(all(b));
int ans = 0;
for(int i=0; i<n; i+=2) {
if(i%2 != b[i].second % 2) ans++;
}
cout<<ans<<endl;
}
Submission Info
Submission Time |
|
Task |
C - BBuBBBlesort! |
User |
Vercingetorix |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1376 Byte |
Status |
WA |
Exec Time |
7 ms |
Memory |
768 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:45:38: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
freopen("input.txt", "rt", stdin);
^
./Main.cpp:46:40: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
freopen("output.txt", "wt", stdout);
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 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 |
WA |
7 ms |
768 KB |
02.txt |
WA |
7 ms |
768 KB |
03.txt |
WA |
7 ms |
768 KB |
04.txt |
WA |
7 ms |
768 KB |
05.txt |
WA |
7 ms |
768 KB |
06.txt |
WA |
7 ms |
768 KB |
07.txt |
WA |
7 ms |
768 KB |
08.txt |
WA |
7 ms |
768 KB |
09.txt |
WA |
7 ms |
768 KB |
10.txt |
WA |
7 ms |
768 KB |
11.txt |
WA |
7 ms |
768 KB |
12.txt |
WA |
7 ms |
768 KB |
13.txt |
WA |
7 ms |
768 KB |
14.txt |
WA |
7 ms |
768 KB |
15.txt |
WA |
7 ms |
768 KB |
16.txt |
WA |
7 ms |
768 KB |
17.txt |
WA |
7 ms |
768 KB |
18.txt |
WA |
7 ms |
768 KB |
19.txt |
WA |
7 ms |
768 KB |
20.txt |
WA |
7 ms |
768 KB |
21.txt |
WA |
7 ms |
768 KB |
22.txt |
WA |
7 ms |
768 KB |
s1.txt |
WA |
7 ms |
768 KB |
s2.txt |
WA |
7 ms |
768 KB |