Submission #1006165

# Submission time Handle Problem Language Result Execution time Memory
1006165 2024-06-23T13:50:44 Z m5588ohammed Data Transfer (IOI19_transfer) C++14
0 / 100
6 ms 5388 KB
#include <bits/stdc++.h>
using namespace std;
vector<int> get_attachment(vector<int> source) {
    int cnt=0,sum=0,k;
    for(int i=0;i<255;i++){
        if(source[i]==1){
            sum++;
            cnt^=i;
        }
    }
    vector <int> ans=source;
    k=sum%2;
    while(cnt!=0){
        ans.push_back(cnt%2);
        cnt/=2;
    }
    ans.push_back(k);
    return ans;
}

vector<int> retrieve(vector<int> data) {
    int cnt=0,sum=0,k=data[data.size()-1],num=0;
    for(int i=0;i<255;i++){
        if(data[i]==1){
            sum++;
            cnt^=i;
        }
    }
    for(int i=255;i<data.size()-1;i++) num+=data[i]*(1<<(i-255));
    if(sum%2!=k&&cnt!=num) data[cnt^num]^=1;
    vector <int> ans;
    for(int i=0;i<255;i++) ans.push_back(data[i]);
    return ans;

}

Compilation message

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int i=255;i<data.size()-1;i++) num+=data[i]*(1<<(i-255));
      |                   ~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1040 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 5388 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -