Submission #341837

# Submission time Handle Problem Language Result Execution time Memory
341837 2020-12-31T07:10:09 Z phathnv COCI17_cezar (COCI17_cezar) C++11
50 / 50
1 ms 512 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 53;

int n, a[N], cnt[12];

void ReadInput(){
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
}

void Solve(){
    int sum = accumulate(a + 1, a + 1 + n, 0);
    if (sum > 21){
        cout << "DOSTA";
        return;
    }
    for(int i = 2; i <= 11; i++)
        cnt[i] = 4;
    cnt[10] = 12;
    for(int i = 1; i <= n; i++)
        cnt[a[i]]--;

    int x = 21 - sum;
    int cntLeq = 0, cntGe = 0;
    for(int i = 2; i <= x; i++)
        cntLeq += cnt[i];
    for(int i = x + 1; i <= 11; i++)
        cntGe += cnt[i];
    cout << (cntGe >= cntLeq? "DOSTA" : "VUCI");
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ReadInput();
    Solve();
    return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct