提出 #1972230


ソースコード 拡げる

/*
	Swamy Saranam

	Date	: 14/01/2018 12:41:19
	Author	: Krishna Mohan A M
	Problem	:
	Status	:
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int,int>	pii;
typedef pair<ld,ld>	pdd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef pair<ll,ll> pll;

#define FASTIO                ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FOR(i,a,b)            for(int i=(a);i<(b);i++)
#define REP(i,n)              FOR(i,0,n)
#define SORT(v)               sort((v).begin(),(v).end())
#define UN(v)                 SORT(v),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define CL(a,b)               memset(a,b,sizeof a)
#define PB                    push_back
#define F                     first
#define S                     second

const int MOD = 1000000007;

ll n, k, tmp, mx;
set<ll> st;
bool pos;

int main()
{
      FASTIO
      cin>>n>>k;
      st.insert(0);
      REP(i, n){
            cin>>tmp;
            mx = max(tmp, mx);
            st.insert(tmp);
      }
      pos = false;
      // cout<<mx<<" : "<<k<<"\n";
      if(k <= mx){
            for(ll it : st){
                  if(it>=k)
                        break;
                  if(st.count(k-it)){
                        pos = true;
                        break;
                  }
            }
      }
      if(pos)
            cout<<"POSSIBLE\n";
      else
            cout<<"IMPOSSIBLE\n";
      return 0;
}

提出情報

提出日時
問題 A - Getting Difference
ユーザ krishnaanaril
言語 C++14 (GCC 5.4.1)
得点 300
コード長 1602 Byte
結果 AC
実行時間 43 ms
メモリ 4992 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 4
AC × 19
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
sample_01.txt AC 1 ms 256 KiB
sample_02.txt AC 1 ms 256 KiB
sample_03.txt AC 1 ms 256 KiB
sample_04.txt AC 1 ms 256 KiB
subtask_1_01.txt AC 1 ms 256 KiB
subtask_1_02.txt AC 1 ms 256 KiB
subtask_1_03.txt AC 43 ms 4992 KiB
subtask_1_04.txt AC 11 ms 256 KiB
subtask_1_05.txt AC 6 ms 256 KiB
subtask_1_06.txt AC 6 ms 896 KiB
subtask_1_07.txt AC 26 ms 2944 KiB
subtask_1_08.txt AC 30 ms 2176 KiB
subtask_1_09.txt AC 15 ms 1920 KiB
subtask_1_10.txt AC 30 ms 2816 KiB
subtask_1_11.txt AC 29 ms 2688 KiB