제출 #1062644

#제출 시각아이디문제언어결과실행 시간메모리
1062644nvujicaDetecting Molecules (IOI16_molecules)C++14
0 / 100
2 ms2396 KiB
#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] & (1 << b)) && !(bio[j] && (1 << 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;
}

컴파일 시 표준 에러 (stderr) 메시지

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:31:63: warning: '<<' in boolean context, did you mean '<'? [-Wint-in-bool-context]
   31 |                     if((bio2[j] & (1 << b)) && !(bio[j] && (1 << b))) kada[(j + 1) * 64 - 1 - b] = i;
      |                                                            ~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...