Submission #845394


Source Code Expand

Copy
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <sstream>
#include <map>
using namespace std;
using ll = long long;

class range {private: struct I{int x;int operator*(){return x;}bool operator!=(I& lhs){return x<lhs.x;}void operator++(){++x;}};I i,n;
public:range(int n):i({0}),n({n}){}range(int i,int n):i({i}),n({n}){}I& begin(){return i;}I& end(){return n;}};

int main() {
  int N;
  while (scanf("%d", &N) != EOF) {
    vector<int> v(N);
    map<int, int> mp;
    for (int i : range(N)) {
      scanf("%d", &v[i]);
      mp[v[i]] = -1;
    }
    int cnt = 1;
    for (auto& it : mp) {
      it.second = cnt++;
    }
    for (int i : range(N)) {
      v[i] = mp[v[i]];
      assert(v[i] >= 1);
    }

    int res = 0;
    for (int i : range(N)) {
      if (i % 2 == 0 && v[i] % 2 == 0) res++;
    }
    printf("%d\n", res);
  }
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:23:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
       scanf("%d", &v[i]);
                         ^

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 126 ms 5376 KB
02.txt AC 126 ms 5376 KB
03.txt AC 126 ms 5376 KB
04.txt AC 124 ms 5376 KB
05.txt AC 120 ms 5376 KB
06.txt AC 122 ms 5376 KB
07.txt AC 122 ms 5376 KB
08.txt AC 79 ms 5376 KB
09.txt AC 78 ms 5376 KB
10.txt AC 81 ms 5376 KB
11.txt AC 78 ms 5376 KB
12.txt AC 78 ms 5376 KB
13.txt AC 77 ms 5376 KB
14.txt AC 120 ms 5376 KB
15.txt AC 120 ms 5376 KB
16.txt AC 121 ms 5376 KB
17.txt AC 122 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