#include<iostream>
#include<vector>
#include<stdlib.h>
using namespace std;
int main() {
int sum = 0;
int N = 0;
cin >> N;
vector<int> arr(N);
vector<int> arr2(N-1);
for (int i = 0; i < N; i++)
{
cin >> arr[i];
}
for (int i = 0; i < N-1; i++)
{
arr2[i] = i+1;
}
for (int i = 0; i < N-1; i++)
{
for (int j = 0; j < N-1; j++)
{
if (arr2[j] == abs(arr[i + 1] - arr[i]))
{
arr2[j] = 0;
}
}
}
for (int i = 0; i < N-1; i++)
{
sum = arr2[i] + sum;
}
if (sum != 0)
{
cout << "NO";
}
else if (sum == 0)
{
cout << "YES";
}
}
26번 (0) |
2020.08.31 |
25번 (0) |
2020.08.31 |
23번 (0) |
2020.08.31 |
22번 (0) |
2020.08.31 |
21번 (0) |
2020.08.30 |