Submission #2235926


Source Code Expand

#include<bits/stdc++.h>

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#endif

using namespace std;

#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define pb push_back
#define fst first
#define snd second
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

int main(){
  int n; cin >> n;
  vi p(n); rep(i,n) cin >> p[i];

  int c = 0;
  rep(i,n){
    if(p[i] == i+1){
      c++;
      i++;
    }
  }
  cout << c << endl;
}

Submission Info

Submission Time
Task D - Derangement
User kimitsu_emt
Language C++14 (GCC 5.4.1)
Score 400
Code Size 833 Byte
Status AC
Exec Time 30 ms
Memory 640 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 4
AC × 15
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt
Case Name Status Exec Time Memory
0_000.txt AC 1 ms 256 KB
0_001.txt AC 1 ms 256 KB
0_002.txt AC 1 ms 256 KB
0_003.txt AC 1 ms 256 KB
1_004.txt AC 1 ms 256 KB
1_005.txt AC 30 ms 640 KB
1_006.txt AC 29 ms 640 KB
1_007.txt AC 29 ms 640 KB
1_008.txt AC 29 ms 640 KB
1_009.txt AC 29 ms 640 KB
1_010.txt AC 30 ms 640 KB
1_011.txt AC 29 ms 640 KB
1_012.txt AC 29 ms 640 KB
1_013.txt AC 29 ms 640 KB
1_014.txt AC 29 ms 640 KB