답안 #405849

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

const int MAXN = 60;

long long mc[MAXN];

bool inf(long long a, long long b) {
    if(log(a) + log(b) > 18) return true;
}
long long count_tastiness(long long x, vector<long long> a) {
	int tot = 0;
	for(int i = 0; i < a.size(); i++) {
        mc[i] = a[i];
	}
    set <long long> s;
    long long cur = 0;
    s.insert(0);
	for(int i  = 0; i < MAXN; i++) {
        int at = a[i] * (1LL << i);
        cur += at;
        if(inf(x, (1LL << i))) continue;
        long long nec = x * (1LL << i);
        set <long long> :: iterator it = s.lower_bound(nec - cur);
        vector <long long> rs;
        while(it != s.end()) {
            rs.push_back(*it);
            it++;
        }
        for(int i = 0; i < rs.size(); i++) {
            s.insert(rs[i] - nec);
        }
	}
	return s.size();
}


Compilation message

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:14:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for(int i = 0; i < a.size(); i++) {
      |                 ~~^~~~~~~~~~
biscuits.cpp:31:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         for(int i = 0; i < rs.size(); i++) {
      |                        ~~^~~~~~~~~~~
biscuits.cpp:13:6: warning: unused variable 'tot' [-Wunused-variable]
   13 |  int tot = 0;
      |      ^~~
biscuits.cpp: In function 'bool inf(long long int, long long int)':
biscuits.cpp:11:1: warning: control reaches end of non-void function [-Wreturn-type]
   11 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 288 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -