Submission #1441579


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, x);
    n = n * 2 - 1;

    if (x == 1 || x == n) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;

    vb used(n+1, false);
    vi ans(n, 0);
    if (x != 2) {
        ans[n/2+1] = x;
        ans[n/2] = x-1;
        ans[n/2+2] = x+1;
        ans[n/2+3] = x-2;
        used[x] = used[x-1] = used[x-2] = used[x+1] = true;
        int ptr = 1;
        rep(i, n) {
            if (!ans[i]) {
                while (used[ptr]) {
                    ptr++;
                }
                ans[i] = ptr;
                used[ptr] = true;
            }
        }
    } else {
        ans[n/2+1] = x;
        ans[n/2] = x+1;
        ans[n/2+2] = x-1;
        ans[n/2+3] = x+2;
        used[x] = used[x-1] = used[x+2] = used[x+1] = true;
        int ptr = 1;
        rep(i, n) {
            if (!ans[i]) {
                while (used[ptr]) {
                    ptr++;
                }
                ans[i] = ptr;
                used[ptr] = true;
            }
        }
    }
    rep(i, n) {
        std::cout << ans[i] << std::endl;
    }

    return 0;
}

Submission Info

Submission Time
Task B - Median Pyramid Easy
User Ti11192916
Language C++14 (GCC 5.4.1)
Score 0
Code Size 2073 Byte
Status RE
Exec Time 314 ms
Memory 3072 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, x);
     ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 2
AC × 12
WA × 6
RE × 4
Set Name Test Cases
Sample 0_00.txt, 0_01.txt
All 0_00.txt, 0_01.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt
Case Name Status Exec Time Memory
0_00.txt AC 1 ms 256 KB
0_01.txt AC 1 ms 256 KB
1_00.txt AC 1 ms 256 KB
1_01.txt RE 96 ms 256 KB
1_02.txt AC 1 ms 256 KB
1_03.txt AC 1 ms 256 KB
1_04.txt RE 95 ms 256 KB
1_05.txt RE 96 ms 256 KB
1_06.txt RE 96 ms 256 KB
1_07.txt AC 1 ms 256 KB
1_08.txt AC 1 ms 256 KB
1_09.txt WA 303 ms 3072 KB
1_10.txt AC 314 ms 3072 KB
1_11.txt AC 312 ms 3072 KB
1_12.txt WA 301 ms 3072 KB
1_13.txt WA 309 ms 3072 KB
1_14.txt AC 1 ms 256 KB
1_15.txt AC 1 ms 256 KB
1_16.txt WA 185 ms 1792 KB
1_17.txt WA 307 ms 2944 KB
1_18.txt WA 125 ms 1408 KB
1_19.txt AC 1 ms 256 KB