Untitled
nur
plain_text
9 months ago
491 B
12
Indexable
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<int> v;
int x;
for (int i = 0; i < 5; i++)
{
cin >> x;
v.push_back(x);
}
vector<int> sv;
sv = v;
sort(sv.begin(), sv.end());
int count = 0;
for (int i = 0; i < v.size(); i++)
{
if (v[i] != sv[i])
count++;
}
if (count == 2)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}Editor is loading...
Leave a Comment