제출 #1363650

#제출 시각아이디문제언어결과실행 시간메모리
1363650timmytimtamData Transfer (IOI19_transfer)C++20
0 / 100
2 ms1724 KiB
#include "transfer.h"

std::vector<int> get_attachment(std::vector<int> source) {
    int xortotal = 0;
    for(int i = 0;i < source.size();i++){
        if(source[i]) xortotal ^= (i+1);
    }
    if(source.size() == 63){
        std::vector<int> attachment(7);
        int parity = 0;
        for(int i = 0;i < 6;i++){
            if((xortotal >> i) & 1){
                attachment[i] = 1;
                parity = !parity;
            }
        }
        attachment[6] = parity;
        return attachment;
    }else{
        std::vector<int> attachment(9);
        int parity = 0;
        for(int i = 0;i < 8;i++){
            if((xortotal >> i) & 1){
                attachment[i] = 1;
                parity = !parity;
            }
        }
        attachment[8] = parity;
        return attachment;
    }
}

std::vector<int> retrieve(std::vector<int> data) {
    std::vector<int> source,attachment;
    int parity = data[data.size() - 1];
    if(data.size() == 70){
        for(int i = 0;i < 63;i++){
            source.push_back(data[i]);
        }
        for(int i = 63;i < data.size()-1;i++){
            attachment.push_back(data[i]);
        }
    }else{
        for(int i = 0;i < 255;i++){
            source.push_back(data[i]);
        }
        for(int i = 255;i < data.size()-1;i++){
            attachment.push_back(data[i]);
        }
    }
    int xortotal = 0,rexortotal = 0, reparity = 0;
    for(int i = 0;i < source.size();i++){
        if(source[i]) xortotal ^= (i+1);
    }
    for(int i = 0;i < attachment.size();i++){
        if(attachment[i]){
            rexortotal += (1<<i);
            reparity = !reparity;
        }
    }
    if(xortotal != rexortotal && parity != reparity){
        source[(xortotal ^ rexortotal) - 1] = !source[(xortotal ^ rexortotal) - 1];
    }
    return source;
}

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

grader.cpp: In instantiation of 'void shuffle(std::vector<T>&) [with T = Scenario]':
grader.cpp:200:10:   required from here
grader.cpp:28:23: warning: 'void std::random_shuffle(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<Scenario*, vector<Scenario> >]' is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
   28 |         random_shuffle(v.begin(), v.end());
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from grader.cpp:8:
/usr/include/c++/13/bits/stl_algo.h:4581:5: note: declared here
 4581 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~~~~~~~~~~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…