Submission #742843

# Submission time Handle Problem Language Result Execution time Memory
742843 2023-05-17T03:51:15 Z nguyentunglam Data Transfer (IOI19_transfer) C++17
Compilation error
0 ms 0 KB
#include "transfer.h"
#include<bits/stdc++.h>
using namespace std;

void up(int &pos) {
    pos++;
    while (__builtin_popcount(pos) > 1) pos++;
}

std::vector<int> get_attachment(std::vector<int> source) {
    int T = source.size() <= 63 ? 7 : 9;
    vector<int> ret(T);
    int pos = 0, timer = 0
    for(int &val : source) {
        up(pos);
        for(int j = 0; j < T; j++) if (pos >> j & 1) timer++;
    }
    return ret;
}

std::vector<int> retrieve(std::vector<int> data) {
//    int T = data.size() - 7 <= 63 ? 7 : 9;
//    int n = data.size() - T;
    vector<int> ret;
//    int pos = 0;
//    for(int i = 0; i < n; i++) {
//        up(pos);
//        for(int j = 0; j < T; j++) if (pos >> j & 1) data[j + n] ^= data[i];
//    }
//    int wrong = 0;
//    pos = 0;
//    for(int j = 0; j < T; j++) if (data[j + n]) wrong |= (1 << j);
//    for(int i = 0; i < n; i++) {
//        up(pos);
//        if (pos == wrong) data[i] ^= 1;
//        ret.push_back(data[i]);
//    }
    return ret;
}

Compilation message

transfer.cpp: In function 'std::vector<int> get_attachment(std::vector<int>)':
transfer.cpp:14:5: error: expected ',' or ';' before 'for'
   14 |     for(int &val : source) {
      |     ^~~
transfer.cpp:13:9: warning: unused variable 'pos' [-Wunused-variable]
   13 |     int pos = 0, timer = 0
      |         ^~~
transfer.cpp:13:18: warning: unused variable 'timer' [-Wunused-variable]
   13 |     int pos = 0, timer = 0
      |                  ^~~~~