답안 #1062649

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1062649 2024-08-17T09:35:07 Z nvujica Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 2648 KB
#include <bits/stdc++.h>
#include "molecules.h"
#define ll long long

using namespace std;

const int maxn = 5e5 + 100;

int n;
unsigned ll bio[maxn / 64];
unsigned ll bio2[maxn / 64];
int kada[maxn];

vector<int> find_subset(int l, int u, vector<int> w) {
    n = w.size();

    memset(kada, -1, sizeof kada);

    for(int i = 0; i < n; i++){
        int d = w[i] / 64;
        int r = w[i] % 64;

        for(int j = 0; j < maxn / 64; j++){
            bio2[j] = bio[j];
            
            if(j - d >= 0) bio2[j] |= (bio[j - d] >> r);
            if(j - d - 1 >= 0) bio2[j] |= (bio[j - d - 1] << (64 - r));

            if(bio2[j] != bio[j]){
                for(int b = 0; b < 64; b++){
                    if((bio2[j] & (1LL << b)) && !(bio[j] && (1LL << b))) kada[(j + 1) * 64 - 1 - b] = i;
                }
            }
        }
    }

    int x = 0;

    for(int i = l; i <= u; i++){
        if(kada[i] != -1){
            x = i;
            break;
        }
    }

    vector <int> v;

    while(x){
        v.push_back(kada[x]);
        x -= w[kada[x]];
    }
    
    reverse(v.begin(), v.end());

    return v;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:31:67: warning: '<<' in boolean context, did you mean '<'? [-Wint-in-bool-context]
   31 |                     if((bio2[j] & (1LL << b)) && !(bio[j] && (1LL << b))) kada[(j + 1) * 64 - 1 - b] = i;
      |                                                              ~~~~~^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2392 KB OK (n = 1, answer = NO)
2 Correct 2 ms 2648 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 2396 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2392 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2392 KB OK (n = 1, answer = NO)
2 Correct 2 ms 2648 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 2396 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2392 KB OK (n = 1, answer = NO)
2 Correct 2 ms 2648 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 2396 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2392 KB OK (n = 1, answer = NO)
2 Correct 2 ms 2648 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 2396 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2392 KB OK (n = 1, answer = NO)
2 Correct 2 ms 2648 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 2396 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -