Submission #23458203
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define u unsigned
#define ull unsigned long long
#define ld long double
#define pb push_back
#define fasterInOut ios::sync_with_stdio(false); cin.tie(0);
#define pi acos(-1)
#define f(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,a,b) for(int i=(a);i>=(b);i--)
#define MAX 1000000
void function(int x);
int main()
{
#ifndef ONLINE_JUDGE
freopen("C:/Users/ASUS/Desktop/inout/input.txt", "r", stdin);
freopen("C:/Users/ASUS/Desktop/inout/output.txt", "w", stdout);
#endif
int n;
cin>>n;
int a[n+1], b[n+1];
int j=1;
for(int i=0;i<n;i++){
a[i]=j;
j++;
}
f(i,0,n-1){
cin>>b[i];
}
sort(b, b+n);
int cnt=0;
f(i,0,n-1){
if(a[i]!=b[i]){
cnt=1;
break;
}
}
if(cnt==0)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Permutation Check |
| User | Hossain_Sanzida |
| Language | C++ (GCC 9.2.1) |
| Score | 200 |
| Code Size | 956 Byte |
| Status | AC |
| Exec Time | 7 ms |
| Memory | 3640 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example_00.txt, example_01.txt, example_02.txt, example_03.txt |
| All | example_00.txt, example_01.txt, example_02.txt, example_03.txt, handmade_00.txt, handmade_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, yes_00.txt, yes_01.txt, yes_02.txt, yes_03.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example_00.txt | AC | 7 ms | 3516 KiB |
| example_01.txt | AC | 2 ms | 3516 KiB |
| example_02.txt | AC | 2 ms | 3584 KiB |
| example_03.txt | AC | 3 ms | 3620 KiB |
| handmade_00.txt | AC | 3 ms | 3628 KiB |
| handmade_01.txt | AC | 2 ms | 3408 KiB |
| random_00.txt | AC | 2 ms | 3412 KiB |
| random_01.txt | AC | 2 ms | 3604 KiB |
| random_02.txt | AC | 2 ms | 3640 KiB |
| random_03.txt | AC | 2 ms | 3572 KiB |
| yes_00.txt | AC | 2 ms | 3528 KiB |
| yes_01.txt | AC | 2 ms | 3524 KiB |
| yes_02.txt | AC | 2 ms | 3520 KiB |
| yes_03.txt | AC | 2 ms | 3564 KiB |