답안 #472995

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472995 2021-09-14T17:48:33 Z Beboo44 Cezar (COCI17_cezar) C++14
25 / 50
1 ms 296 KB
#include <bits/stdc++.h>
using namespace std;
#define all(v)			((v).begin()), ((v).end())
#define sz(v)			((int)((v).size()))
typedef long long ll;
typedef vector<int> vi;
typedef vector<pair<ll , int> > vpli;
typedef set<char> st;
typedef stack<int> s;
typedef deque<int> dq;
typedef queue<int> q;
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0)


int main()
{
   ll n;
   cin>>n;
   ll arr[12]={0};
   for(int i=2; i<=12; ++i){
    arr[i]=4;
   }
   arr[10]+=12;

   vector<ll>v(n);
   ll sum=0;
   for(int i=0; i<n; ++i){
    cin>>v[i];
    arr[v[i]]--;
    sum+=v[i];
   }
   ll ans= 21-sum;
   ll sum1=0;
   ll sum2=0;

   for(int i=ans+1; i<12; ++i){
    sum1+=arr[i];
   }
   for(int i=ans; i>=0; --i){
    sum2+=arr[i];
   }
   if(sum1>sum2){
    cout<<"DOSTA";
   }
   else{
    cout<<"VUCI";
   }





    return 0;
}

Compilation message

cezar.cpp: In function 'int main()':
cezar.cpp:21:11: warning: iteration 10 invokes undefined behavior [-Waggressive-loop-optimizations]
   21 |     arr[i]=4;
      |     ~~~~~~^~
cezar.cpp:20:18: note: within this loop
   20 |    for(int i=2; i<=12; ++i){
      |                 ~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -