Submission #1445295


Source Code Expand

#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
	ll n, k;
	cin >> n >> k;
	vl a(n);
	rep(i, n) {
		cin >> a[i];
		if(a[i] == k) {
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}
	sort(all(a));
	if(a.back() < k || n == 1) {
		cout << "IMPOSSIBLE" << endl;
		return 0;
	}
	bool f = false;
	if(n == 2) {
		if(a[0] != a[1]) cout << "POSSIBLE" << endl;
		else cout << "IMPOSSIBLE" << endl;
		return 0;
	}
	ll dif = a[1] - a[0];
	REP(i, 1, n) {
		if(a[i] - a[i-1] != dif) f = true;
	}
	cout << (f ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}

Submission Info

Submission Time
Task A - Getting Difference
User T1610
Language C++14 (GCC 5.4.1)
Score 0
Code Size 997 Byte
Status WA
Exec Time 47 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 4
AC × 17
WA × 2
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
sample_04.txt AC 1 ms 256 KB
subtask_1_01.txt AC 1 ms 256 KB
subtask_1_02.txt AC 1 ms 256 KB
subtask_1_03.txt AC 47 ms 1024 KB
subtask_1_04.txt AC 2 ms 1024 KB
subtask_1_05.txt AC 22 ms 640 KB
subtask_1_06.txt AC 8 ms 384 KB
subtask_1_07.txt WA 28 ms 768 KB
subtask_1_08.txt AC 41 ms 896 KB
subtask_1_09.txt AC 19 ms 512 KB
subtask_1_10.txt WA 33 ms 768 KB
subtask_1_11.txt AC 37 ms 896 KB