提出 #44652839


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;

#define x first
#define y second
#define fro(i, x, y) for(int i = (x);i <= (y);i++)
#define pre(i, x, y) for(int i = (x);i >= (y);i--)

typedef long long ll;
typedef __int128 lll;
typedef unsigned int uint;
typedef pair<int, int> PII;
typedef unsigned long long ull;

const int N = 1000010;
const int mod = 998244353;

int n, m, a[N];

signed main()
{
    ios::sync_with_stdio(0), cin.tie(0);
    cin >> n >> m;
    fro(i, 1, m) cin >> a[i];
    int op[2] = {0};
    fro(i, 1, m) op[a[i] % 2]++;
    if(op[1] > 2) cout << "Impossible", exit(0);
    fro(i, 2, m - 1) if(a[i] % 2 == 1) swap(a[i], a[1]);
    fro(i, 2, m - 1) if(a[i] % 2 == 1) swap(a[i], a[m]);
    fro(i, 1, m) cout << a[i] << " "; cout << "\n";
    if(m == 1)
    {
        if(a[1] == 1) cout << "1\n1";
        else cout << "2\n" << a[1] - 1 << " 1";
    }
    else
    {
        vector<int> ans; ans.clear();
        if(a[1] != 1) ans.push_back(a[1] - 1);
        fro(i, 2, m - 1) ans.push_back(a[i]);
        ans.push_back(a[m] + 1);
        cout << ans.size() << "\n";
        for(auto i : ans) cout << i << " ";
    }
    return 0;
}

提出情報

提出日時
問題 D - Arrays and Palindrome
ユーザ win114514
言語 C++ (GCC 9.2.1)
得点 1000
コード長 1196 Byte
結果 AC
実行時間 7 ms
メモリ 3564 KiB

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:6:22: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
    6 | #define fro(i, x, y) for(int i = (x);i <= (y);i++)
      |                      ^~~
./Main.cpp:30:5: note: in expansion of macro ‘fro’
   30 |     fro(i, 1, m) cout << a[i] << " "; cout << "\n";
      |     ^~~
./Main.cpp:30:39: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
   30 |     fro(i, 1, m) cout << a[i] << " "; cout << "\n";
      |                                       ^~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 1000 / 1000
結果
AC × 3
AC × 31
セット名 テストケース
Sample sample-01.txt, sample-02.txt, sample-03.txt
All sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, sample-01.txt, sample-02.txt, sample-03.txt
ケース名 結果 実行時間 メモリ
01-01.txt AC 7 ms 3484 KiB
01-02.txt AC 2 ms 3404 KiB
01-03.txt AC 2 ms 3424 KiB
01-04.txt AC 3 ms 3408 KiB
01-05.txt AC 2 ms 3552 KiB
01-06.txt AC 3 ms 3488 KiB
01-07.txt AC 2 ms 3560 KiB
01-08.txt AC 2 ms 3480 KiB
01-09.txt AC 4 ms 3480 KiB
01-10.txt AC 3 ms 3556 KiB
01-11.txt AC 3 ms 3428 KiB
01-12.txt AC 2 ms 3484 KiB
01-13.txt AC 2 ms 3428 KiB
01-14.txt AC 3 ms 3440 KiB
01-15.txt AC 2 ms 3496 KiB
01-16.txt AC 2 ms 3468 KiB
01-17.txt AC 3 ms 3428 KiB
01-18.txt AC 2 ms 3556 KiB
01-19.txt AC 3 ms 3552 KiB
01-20.txt AC 7 ms 3492 KiB
01-21.txt AC 3 ms 3564 KiB
01-22.txt AC 3 ms 3468 KiB
01-23.txt AC 2 ms 3544 KiB
01-24.txt AC 3 ms 3408 KiB
01-25.txt AC 4 ms 3496 KiB
sample-01.txt AC 2 ms 3460 KiB
sample-02.txt AC 4 ms 3528 KiB
sample-03.txt AC 2 ms 3528 KiB