제출 #598752

#제출 시각아이디문제언어결과실행 시간메모리
598752farhan132Data Transfer (IOI19_transfer)C++17
100 / 100
205 ms2500 KiB
#include "transfer.h" #include <bits/stdc++.h> using namespace std; typedef int ll; typedef pair<ll , ll> ii; #define ff first #define ss second #define pb push_back #define in insert std::vector<int> get_attachment(std::vector<int> source) { ll n = source.size(); ll lg = log2(n + 1); ll x = 0; for(auto u : source) x ^= u; source.pb(x); vector < ll > ans; ans.pb(x); n++; for(ll bit = 0; bit < lg; bit++){ x = 0; for(ll i = 0; i < n; i++){ if((i >> bit)&1) x ^= source[i]; } ans.pb(x); } return ans; } std::vector<int> retrieve(std::vector<int> data) { ll n = 256; if(data.size() < n) n = 64; ll x = 0; for(ll i = 0; i < n - 1; i++){ x ^= data[i]; } if(data[n - 1] != x){ ll m = data.size(); ll cur = 0; for(ll j = n; j < m; j++){ ll bit = j - n; x = 0; for(ll i = 0; i < n; i++){ if((i >> bit)&1) x ^= data[i]; } if(x != data[j]) cur |= (1 << bit); } data[cur] ^= 1; } while(data.size() > n-1) data.pop_back(); return data; }

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

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:38:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'int'} [-Wsign-compare]
   38 |  if(data.size() < n) n = 64;
      |     ~~~~~~~~~~~~^~~
transfer.cpp:55:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'int'} [-Wsign-compare]
   55 |  while(data.size() > n-1) data.pop_back();
      |        ~~~~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...