Submission #1445298


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define Edge pair< int, i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dij geo2

signed main()
{
    int2(n, k);
    vi data(n);

    int base = INF, infi = 0;
    rep(i, n) {
        cin >> data[i];
        base = min(base, data[i]);
        infi = max(infi, data[i]);
    }

    if (n == 1 && base == k) {
        std::cout << "POSSIBLE" << std::endl;
    } else if (n == 1) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }

    if (infi < k) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }

    rep(i, n) {
        if (data[i] % base) {
            std::cout << "POSSIBLE" << std::endl;
            return 0;
        }
    }

    if (k % base) {
        std::cout << "IMPOSSIBLE" << std::endl;
        return 0;
    } else {
        std::cout << "POSSIBLE" << std::endl;
    }




    return 0;
}


Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:24:56: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 #define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
                                                        ^
./Main.cpp:37:5: note: in expansion of macro ‘int2’
     int2(n, k);
     ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 4
AC × 16
WA × 3
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 WA 1 ms 256 KB
subtask_1_02.txt AC 1 ms 256 KB
subtask_1_03.txt AC 40 ms 1024 KB
subtask_1_04.txt AC 41 ms 1024 KB
subtask_1_05.txt AC 25 ms 640 KB
subtask_1_06.txt AC 7 ms 384 KB
subtask_1_07.txt WA 25 ms 768 KB
subtask_1_08.txt AC 35 ms 896 KB
subtask_1_09.txt AC 17 ms 512 KB
subtask_1_10.txt WA 29 ms 768 KB
subtask_1_11.txt AC 32 ms 896 KB