AtCoder Grand Contest 002

Submission #8515279

Source codeソースコード

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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    ll n, l;
    cin >> n >> l;
    vll a(n);
    rep(i, n) cin >> a[i];

    int idx = -1;
    rep(i, n - 1) {
        if (a[i] + a[i + 1] >= l) {
            idx = i;
            break;
        }
    }

    if (idx < 0) {
        cout << "Impossible" << endl;
        return 0;
    }

    vll ans;
    for (int i = idx; i < n - 1; i++) ans.push_back(i);
    for (int i = idx - 1; i >= 0; i--) ans.push_back(i);
    reverse(all(ans));

    cout << "Possible" << endl;
    rep(i, n - 1) {
        cout << ans[i] + 1 << endl;
    }

    return 0;
}

Submission

Task問題 C - Knot Puzzle
User nameユーザ名 kazuhitot
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 500
Source lengthソースコード長 1042 Byte
File nameファイル名
Exec time実行時間 166 ms
Memory usageメモリ使用量 2548 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - 0_00.txt,0_01.txt,0_02.txt
All 500 / 500 0_00.txt,0_01.txt,0_02.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,1_20.txt,1_21.txt,1_22.txt,1_23.txt,1_24.txt,1_25.txt,1_26.txt,1_27.txt,1_28.txt,1_29.txt,1_30.txt,1_31.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
0_00.txt AC 1 ms 256 KB
0_01.txt AC 1 ms 256 KB
0_02.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 159 ms 2548 KB
1_03.txt AC 7 ms 1024 KB
1_04.txt AC 164 ms 2548 KB
1_05.txt AC 7 ms 1024 KB
1_06.txt AC 160 ms 2548 KB
1_07.txt AC 7 ms 1024 KB
1_08.txt AC 161 ms 2548 KB
1_09.txt AC 7 ms 1024 KB
1_10.txt AC 161 ms 2548 KB
1_11.txt AC 7 ms 1024 KB
1_12.txt AC 166 ms 2548 KB
1_13.txt AC 11 ms 1024 KB
1_14.txt AC 164 ms 2548 KB
1_15.txt AC 1 ms 256 KB
1_16.txt AC 1 ms 256 KB
1_17.txt AC 11 ms 1024 KB
1_18.txt AC 159 ms 2420 KB
1_19.txt AC 11 ms 1024 KB
1_20.txt AC 10 ms 1024 KB
1_21.txt AC 163 ms 2548 KB
1_22.txt AC 157 ms 2420 KB
1_23.txt AC 11 ms 1024 KB
1_24.txt AC 147 ms 2292 KB
1_25.txt AC 11 ms 1024 KB
1_26.txt AC 154 ms 2420 KB
1_27.txt AC 161 ms 2420 KB
1_28.txt AC 159 ms 2420 KB
1_29.txt AC 149 ms 2292 KB
1_30.txt AC 162 ms 2420 KB
1_31.txt AC 149 ms 2292 KB