답안 #374833

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
374833 2021-03-08T09:47:14 Z Jarif_Rahman 비스킷 담기 (IOI20_biscuits) C++17
0 / 100
2 ms 364 KB
#include "biscuits.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
const int kk = 200;
ll count_tastiness(ll x, vector<ll> a){
    int k = a.size();
    a.resize(kk, 0);
    ll ans = 1, c0 = 0, c1 = 0, cur = 0;
    int block = -1;
    for(int i = 0; i < kk; i++){
        if(a[i] == 0){
            ans*=max(cur, 1LL);
            cur = 0, c0 = 0, c1 = 0;
            block = i;
            continue;
        }
        if(a[i] == 1){
            cur+=1;
            for(int j = i-1; j > block; j--){
                if(a[j] == 1){
                    ll s = j-block-1;
                    s = 1LL<<s;
                    cur+=s;
                }
            }
            c1++;
            continue;
        }
        ll s = c0+c1;
        s = 1LL<<s;
        cur+=s;
        if(i != kk-1) a[i+1]+=a[i]/2;
        a[i]%=2;
        (a[i] == 0? c0: c1)++;
    }
    if(!all_of(a.begin(), a.end(), [&](ll x){return x == 0;})) ans++;
    return ans;
}

Compilation message

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:11:9: warning: unused variable 'k' [-Wunused-variable]
   11 |     int k = a.size();
      |         ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Incorrect 1 ms 364 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -