제출 #1126150

#제출 시각아이디문제언어결과실행 시간메모리
1126150HasanV11010238DEL13 (info1cup18_del13)C++20
0 / 100
14 ms1096 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double int main(){ ll t; cin>>t; while (t--){ int n, k; cin>>n>>k; vector<int> v(k + 2, 0); for (int i = 1; i <= k; i++){ cin>>v[i]; } v[k + 1] = n + 1; vector<int> ord; for (int i = 0; i <= k; i++){ ord.push_back(v[i + 1] - v[i] - 1); if (ord[i] != 0){ if (ord[i] % 2 == 0){ ord[i] = 2; } else{ ord[i] = 1; } } } bool can = 1; for (int i = 0; i <= k; i++){ if (i == k && ord[i] != 0){ can = 0; break; } else if (i == k){ continue; } if (i != k && ord[i] < 0){ can = 0; } else{ ord[i + 1] -= ord[i]; } } if (can){ cout<<(n - k) / 2<<"\n"; for (int i = 0; i < (n - k) / 2; i++){ cout<<n / 2 + 1<<" "; } cout<<"\n"; } else{ cout<<-1<<"\n"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...