답안 #95033

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
95033 2019-01-27T06:11:32 Z Osama_Alkhodairy DEL13 (info1cup18_del13) C++17
0 / 100
11 ms 888 KB
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

void solve(){
    int n, k;
    cin >> n >> k;
    vector <int> a;
    for(int i = 0 ; i < k ; i++){
        int x;
        cin >> x;
        a.push_back(x);
    }
    a.push_back(0);
    a.push_back(n + 1);
    sort(a.begin(), a.end());
    vector <int> b;
    for(int i = 1 ; i < (int)a.size() ; i++)
        b.push_back(a[i] - a[i - 1] - 1);
    for(auto &i : b)
        while(i >= 3)
            i -= 2;
    for(int i = 0 ; i + 1 < (int)b.size() ; i++)
        b[i + 1] -= b[i], b[i] = 0;
    for(auto &i : b){
        if(i != 0){
            cout << -1 << endl;
            return;
        }
    }
    cout << 0 << endl << endl;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int T;
    cin >> T;
    while(T--) solve();
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Incorrect 3 ms 376 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Incorrect 3 ms 376 KB Output isn't correct
3 Incorrect 11 ms 376 KB Output isn't correct
4 Incorrect 10 ms 376 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Incorrect 4 ms 376 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Incorrect 3 ms 376 KB Output isn't correct
3 Incorrect 11 ms 376 KB Output isn't correct
4 Incorrect 10 ms 376 KB Output isn't correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Incorrect 3 ms 376 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Incorrect 3 ms 376 KB Output isn't correct
3 Incorrect 11 ms 376 KB Output isn't correct
4 Incorrect 10 ms 376 KB Output isn't correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Incorrect 3 ms 376 KB Output isn't correct
8 Incorrect 7 ms 504 KB Output isn't correct
9 Incorrect 8 ms 620 KB Output isn't correct
10 Incorrect 8 ms 664 KB Output isn't correct
11 Incorrect 8 ms 888 KB Output isn't correct