답안 #405805

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
405805 2021-05-16T22:52:13 Z ly20 비스킷 담기 (IOI20_biscuits) C++17
9 / 100
1000 ms 332 KB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 40, INF = 1e9;

long long mc[MAXN];

long long count_tastiness(long long x, vector<long long> a) {
	long long resp = 0;
	int tot = 0;
	for(int i = 0; i < a.size(); i++) {
        tot += a[i] * (1 << i);
	}
	for(int j  = 0; j <= tot; j++) {
        for(int i = 0; i < 32; i++) {
            if(i > a.size() - 1) mc[i] = 0;
            else mc[i] = a[i];
        }
        bool ok = true;
        for(int i = 0; i < 32; i++) {
            if((1 << i) & j) {
                if(mc[i] < x) {
                    ok = false;
                    break;
                }
                mc[i] -= x;
            }
            mc[i + 1] += mc[i] / 2;
        }
        if(ok) resp++;
	}
	return resp;
}

Compilation message

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:12:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |  for(int i = 0; i < a.size(); i++) {
      |                 ~~^~~~~~~~~~
biscuits.cpp:17:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |             if(i > a.size() - 1) mc[i] = 0;
      |                ~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 204 KB Output is correct
2 Correct 30 ms 204 KB Output is correct
3 Correct 23 ms 264 KB Output is correct
4 Correct 41 ms 268 KB Output is correct
5 Correct 11 ms 292 KB Output is correct
6 Correct 130 ms 204 KB Output is correct
7 Correct 7 ms 292 KB Output is correct
8 Correct 108 ms 204 KB Output is correct
9 Correct 14 ms 204 KB Output is correct
10 Correct 52 ms 204 KB Output is correct
11 Correct 10 ms 204 KB Output is correct
12 Correct 77 ms 272 KB Output is correct
13 Correct 81 ms 204 KB Output is correct
14 Correct 57 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 204 KB Output is correct
2 Execution timed out 1087 ms 204 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1093 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1081 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 204 KB Output is correct
2 Correct 30 ms 204 KB Output is correct
3 Correct 23 ms 264 KB Output is correct
4 Correct 41 ms 268 KB Output is correct
5 Correct 11 ms 292 KB Output is correct
6 Correct 130 ms 204 KB Output is correct
7 Correct 7 ms 292 KB Output is correct
8 Correct 108 ms 204 KB Output is correct
9 Correct 14 ms 204 KB Output is correct
10 Correct 52 ms 204 KB Output is correct
11 Correct 10 ms 204 KB Output is correct
12 Correct 77 ms 272 KB Output is correct
13 Correct 81 ms 204 KB Output is correct
14 Correct 57 ms 204 KB Output is correct
15 Correct 18 ms 204 KB Output is correct
16 Execution timed out 1087 ms 204 KB Time limit exceeded
17 Halted 0 ms 0 KB -