提出 #62051339
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int n=5;
vector<int>a(n),b(n);
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=a[i];
}
int d=0;
sort(b.begin(),b.end());
for(int i=0;i<5;i++){
if(a[i]==b[i]) d++;
}
if(d==5) cout<<"No\n";
else{
int c=0;
for(int i=0;i<4;i++){
if(a[i]>a[i+1]){
int temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
break;
}
}
for(int i=0;i<5;i++){
if(a[i]!=b[i]){
c++;
break;
}
}
if(c==1) cout<<"No\n";
else cout<<"Yes\n";
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - 12435 |
| ユーザ | noobslayerk07 |
| 言語 | C++ 20 (gcc 12.2) |
| 得点 | 150 |
| コード長 | 718 Byte |
| 結果 | AC |
| 実行時間 | 1 ms |
| メモリ | 3648 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 150 / 150 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 02_Yes_00.txt, 02_Yes_01.txt, 03_No_00.txt, 03_No_01.txt, 03_No_02.txt, 03_No_03.txt, 03_No_04.txt, 03_No_05.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3432 KiB |
| 00_sample_01.txt | AC | 1 ms | 3444 KiB |
| 00_sample_02.txt | AC | 1 ms | 3492 KiB |
| 00_sample_03.txt | AC | 1 ms | 3432 KiB |
| 01_handmade_00.txt | AC | 1 ms | 3648 KiB |
| 01_handmade_01.txt | AC | 1 ms | 3448 KiB |
| 01_handmade_02.txt | AC | 1 ms | 3464 KiB |
| 02_Yes_00.txt | AC | 1 ms | 3568 KiB |
| 02_Yes_01.txt | AC | 1 ms | 3648 KiB |
| 03_No_00.txt | AC | 1 ms | 3564 KiB |
| 03_No_01.txt | AC | 1 ms | 3364 KiB |
| 03_No_02.txt | AC | 1 ms | 3572 KiB |
| 03_No_03.txt | AC | 1 ms | 3364 KiB |
| 03_No_04.txt | AC | 1 ms | 3456 KiB |
| 03_No_05.txt | AC | 1 ms | 3548 KiB |