Submission #3767967
Source Code Expand
#include <bits/stdc++.h> #define rep(i, m, n) for(int i = m; i < (n); i++) #define print(x) cout << (x) << endl; #define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl; #define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;} #define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl; #define INF (1e18) using namespace std; typedef long long ll; const ll MOD = 1e9 + 7; typedef struct{ int x; int y; } P; typedef struct{ ll to; ll cost; } edge; typedef pair<ll, ll> lpair; int main(){ cin.tie(0); ios::sync_with_stdio(false); ll N,L; ll a[100010]; cin >> N >> L; rep(i,0,N){ cin >> a[i]; } ll sum[100010] = {}; rep(i,0,N){ sum[i+1] = sum[i] + a[i]; } ll val = sum[N]; // print(val); ll rv = N-1; ll lv = 0; vector<ll> ans; ll cnt = 0; bool is_ok = false; ll pos = -1; rep(i,0,N-1){ if(a[i] + a[i+1] >= L){ is_ok = true; pos = i; } } // print(pos); if(!is_ok){ print("Impossible"); return 0; } print("Possible"); rep(i,0,pos){ print(i+1); } for(int i = N-2; i >= pos+1; i--){ print(i+1); } print(pos+1); }
Submission Info
Submission Time | |
---|---|
Task | C - Knot Puzzle |
User | yuji9511 |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1445 Byte |
Status | AC |
Exec Time | 165 ms |
Memory | 1664 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
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 | 160 ms | 1664 KB |
1_03.txt | AC | 7 ms | 1024 KB |
1_04.txt | AC | 156 ms | 1664 KB |
1_05.txt | AC | 7 ms | 1024 KB |
1_06.txt | AC | 157 ms | 1664 KB |
1_07.txt | AC | 7 ms | 1024 KB |
1_08.txt | AC | 157 ms | 1664 KB |
1_09.txt | AC | 7 ms | 1024 KB |
1_10.txt | AC | 154 ms | 1664 KB |
1_11.txt | AC | 7 ms | 1024 KB |
1_12.txt | AC | 159 ms | 1664 KB |
1_13.txt | AC | 11 ms | 1024 KB |
1_14.txt | AC | 161 ms | 1664 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 | 155 ms | 1536 KB |
1_19.txt | AC | 11 ms | 1024 KB |
1_20.txt | AC | 10 ms | 1024 KB |
1_21.txt | AC | 160 ms | 1664 KB |
1_22.txt | AC | 157 ms | 1536 KB |
1_23.txt | AC | 11 ms | 1024 KB |
1_24.txt | AC | 146 ms | 1536 KB |
1_25.txt | AC | 11 ms | 1024 KB |
1_26.txt | AC | 150 ms | 1536 KB |
1_27.txt | AC | 165 ms | 1536 KB |
1_28.txt | AC | 158 ms | 1536 KB |
1_29.txt | AC | 145 ms | 1536 KB |
1_30.txt | AC | 156 ms | 1536 KB |
1_31.txt | AC | 144 ms | 1536 KB |