Submission #7646963


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n, l;
    cin >> n >> l;
    vint a(n);
    vint d(n-1);
    int idx = INF;
    rep(i, n) {
        cin >> a[i];
        if (i > 0) {
            d[i-1] = a[i-1] + a[i];
            if (d[i-1] >= l) idx = i-1;
        }
    }
    if (idx == INF) {
        puts("Impossible");
        return 0;
    }
    puts("Possible");
    rep(i, idx) {
        cout << i+1 << endl;
    }
    for (int i = n-2; i > idx; --i) {
        cout << i+1 << endl;
    }
    cout << idx+1 << endl;

    return 0;
}

Submission Info

Submission Time
Task C - Knot Puzzle
User sksim
Language C++14 (GCC 5.4.1)
Score 500
Code Size 2255 Byte
Status AC
Exec Time 195 ms
Memory 1664 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 35
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt
All 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
Case Name Status Exec Time Memory
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 169 ms 1664 KB
1_03.txt AC 17 ms 1024 KB
1_04.txt AC 170 ms 1536 KB
1_05.txt AC 17 ms 1024 KB
1_06.txt AC 167 ms 1536 KB
1_07.txt AC 17 ms 1024 KB
1_08.txt AC 172 ms 1664 KB
1_09.txt AC 17 ms 1024 KB
1_10.txt AC 168 ms 1536 KB
1_11.txt AC 17 ms 1024 KB
1_12.txt AC 193 ms 1536 KB
1_13.txt AC 41 ms 1024 KB
1_14.txt AC 195 ms 1536 KB
1_15.txt AC 1 ms 256 KB
1_16.txt AC 1 ms 256 KB
1_17.txt AC 39 ms 1024 KB
1_18.txt AC 186 ms 1536 KB
1_19.txt AC 40 ms 1024 KB
1_20.txt AC 37 ms 896 KB
1_21.txt AC 191 ms 1536 KB
1_22.txt AC 184 ms 1536 KB
1_23.txt AC 39 ms 1024 KB
1_24.txt AC 173 ms 1408 KB
1_25.txt AC 39 ms 1024 KB
1_26.txt AC 178 ms 1536 KB
1_27.txt AC 194 ms 1536 KB
1_28.txt AC 186 ms 1536 KB
1_29.txt AC 173 ms 1408 KB
1_30.txt AC 187 ms 1536 KB
1_31.txt AC 180 ms 1536 KB