Submission #1441619


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);

    if (n == 2 && x == 2) {
        cout << "Yes" << endl << 1 << endl << 2 << endl << 3 << endl;
        return 0;
    }
    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) {
        for (int i = x-2; i < x+2; i++) {
            used[i] = true;
        }
        //used[x] = used[x-1] = used[x-2] = used[x+1] = true;
        int ptr = 1;
        rep(i, n / 2-1) {
            while (used[ptr]) ptr++;
            std::cout << ptr++ << std::endl;
        }
        cout << x-1 << endl << x << endl << x+1 << endl << x-2 << endl;
        while (ptr <= n) {
            while (ptr <= n && used[ptr]) ptr++;
            if (ptr > n) break;
            std::cout << ptr++ << std::endl;
        }
    } else {
        for (int i = x-1; i < x+3; i++) {
            used[i] = true;
        }
        //used[x] = used[x-1] = used[x+2] = used[x+1] = true;

        int ptr = 1;
        rep(i, n / 2-1) {
            while (used[ptr]) ptr++;
            std::cout << ptr++ << std::endl;
        }
        cout << x+1 << endl << x << endl << x-1 << endl << x+2 << endl;
        while (ptr <= n) {
            while (ptr <= n && used[ptr]) ptr++;
            if (ptr > n) break;
            std::cout << ptr++ << std::endl;
        }
    }

    return 0;
}

Submission Info

Submission Time
Task B - Median Pyramid Easy
User Ti11192916
Language C++14 (GCC 5.4.1)
Score 400
Code Size 2372 Byte
Status AC
Exec Time 307 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 400 / 400
Status
AC × 2
AC × 22
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 AC 1 ms 256 KB
1_02.txt AC 1 ms 256 KB
1_03.txt AC 1 ms 256 KB
1_04.txt AC 1 ms 256 KB
1_05.txt AC 1 ms 256 KB
1_06.txt AC 1 ms 256 KB
1_07.txt AC 1 ms 256 KB
1_08.txt AC 1 ms 256 KB
1_09.txt AC 301 ms 3072 KB
1_10.txt AC 296 ms 3072 KB
1_11.txt AC 305 ms 3072 KB
1_12.txt AC 307 ms 3072 KB
1_13.txt AC 307 ms 3072 KB
1_14.txt AC 1 ms 256 KB
1_15.txt AC 1 ms 256 KB
1_16.txt AC 179 ms 1792 KB
1_17.txt AC 289 ms 2944 KB
1_18.txt AC 125 ms 1408 KB
1_19.txt AC 1 ms 256 KB