Submission #2174670
Source Code Expand
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <queue> #include <set> #include <map> #include <string.h> #include <cmath> using namespace std; typedef long long i64; typedef long double ld; typedef pair<i64,i64> P; #define rep(i,s,e) for(int (i) = (s);(i) <= (e);++(i)) int n; i64 a[100010]; int main() { cin >> n; rep(i,1,n) cin >> a[i]; int result = 0; rep(i,1,n - 1) if(a[i] == i) { result++; swap(a[i],a[i + 1]); } cout << result << endl; }
Submission Info
Submission Time | |
---|---|
Task | D - Derangement |
User | niuez |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 540 Byte |
Status | WA |
Exec Time | 30 ms |
Memory | 1024 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
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 | WA | 1 ms | 256 KB |
1_005.txt | AC | 29 ms | 1024 KB |
1_006.txt | AC | 30 ms | 1024 KB |
1_007.txt | AC | 28 ms | 1024 KB |
1_008.txt | WA | 29 ms | 1024 KB |
1_009.txt | WA | 29 ms | 1024 KB |
1_010.txt | AC | 28 ms | 1024 KB |
1_011.txt | WA | 28 ms | 1024 KB |
1_012.txt | AC | 29 ms | 1024 KB |
1_013.txt | AC | 29 ms | 1024 KB |
1_014.txt | AC | 29 ms | 1024 KB |