#include <bits/stdc++.h>
#include "transfer.h"
using namespace std;
#define ll long long
#define ld double
#define FOR(i,l,r) for(int i = (l), _r = (r); i <= _r; i++)
#define FORNG(i,r,l) for(int i = (r), _l = (l); i >= _l; i--)
#define REP(i,r) for(int i = 0, _r = (r); i < _r; i++)
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define size(v) ((ll)(v).size())
#define MASK(x) (1LL << (x))
#define BIT(x, i) (((x) >> (i)) & 1)
const ll MOD = 1e9 + 7, N = 3e5 + 10, INF = 2e18, LOG = 21;
//63 255
vector<int> get_attachment(vector<int> source) {
int x = 0;
int o = 0;
vector<int> res;
REP(i,size(source))if(source[i]){
x ^= i + 1;
o ^= 1;
}
if(size(source) == 63){
res.pb(o);
FORNG(i,5,0)res.pb(BIT(x, i));
}else{
res.pb(o);
FORNG(i,7,0)res.pb(BIT(x, i));
}
// cerr<<x<<' '<<o<<endl;
return res;
}
vector<int> retrieve(vector<int> data) {
vector<int> res;
if(size(data) == 63 + 7){
int x = 0, curx = 0;
int o = data[63], curo = 0;
REP(i,63)if(data[i])curx ^= i + 1,curo^=1;
FOR(i,64,size(data) - 1)x = x * 2 + data[i];
if(o == curo){
while(size(data) > 63)data.pop_back();
res = data;
}else{
if(x == curx){
while(size(data) > 63)data.pop_back();
res = data;
}else{
data[(x ^ curx) - 1] ^= 1;
while(size(data) > 63)data.pop_back();
res = data;
}
}
}else{
int x = 0, curx = 0;
int o = data[255], curo = 0;
REP(i,255)if(data[i])curx ^= i + 1,curo^=1;
FOR(i,255 + 1,size(data) - 1)x = x * 2 + data[i];
if(o == curo){
while(size(data) > 255)data.pop_back();
res = data;
}else{
if(x == curx){
while(size(data) > 255)data.pop_back();
res = data;
}else{
data[(x ^ curx) - 1] ^= 1;
while(size(data) > 255)data.pop_back();
res = data;
}
}
}
return res;
}
#undef ll long long
#undef ld double
#undef FOR(i,l,r) for(int i = (l), _r = (r); i <= _r; i++)
#undef FORNG(i,r,l) for(int i = (r), _l = (l); i >= _l; i--)
#undef REP(i,r) for(int i = 0, _r = (r); i < _r; i++)
#undef endl '\n'
#undef fi first
#undef se second
#undef pb push_back
#undef all(v) (v).begin(),(v).end()
#undef size(v) ((ll)(v).size())
#undef MASK(x) (1LL << (x))
#undef BIT(x, i) (((x) >> (i)) & 1)
컴파일 시 표준 에러 (stderr) 메시지
transfer.cpp:82:11: warning: extra tokens at end of #undef directive
82 | #undef ll long long
| ^~~~
transfer.cpp:83:11: warning: extra tokens at end of #undef directive
83 | #undef ld double
| ^~~~~~
transfer.cpp:84:11: warning: extra tokens at end of #undef directive
84 | #undef FOR(i,l,r) for(int i = (l), _r = (r); i <= _r; i++)
| ^
transfer.cpp:85:13: warning: extra tokens at end of #undef directive
85 | #undef FORNG(i,r,l) for(int i = (r), _l = (l); i >= _l; i--)
| ^
transfer.cpp:86:11: warning: extra tokens at end of #undef directive
86 | #undef REP(i,r) for(int i = 0, _r = (r); i < _r; i++)
| ^
transfer.cpp:87:13: warning: extra tokens at end of #undef directive
87 | #undef endl '\n'
| ^~~~
transfer.cpp:88:11: warning: extra tokens at end of #undef directive
88 | #undef fi first
| ^~~~~
transfer.cpp:89:11: warning: extra tokens at end of #undef directive
89 | #undef se second
| ^~~~~~
transfer.cpp:90:11: warning: extra tokens at end of #undef directive
90 | #undef pb push_back
| ^~~~~~~~~
transfer.cpp:91:11: warning: extra tokens at end of #undef directive
91 | #undef all(v) (v).begin(),(v).end()
| ^
transfer.cpp:92:12: warning: extra tokens at end of #undef directive
92 | #undef size(v) ((ll)(v).size())
| ^
transfer.cpp:93:12: warning: extra tokens at end of #undef directive
93 | #undef MASK(x) (1LL << (x))
| ^
transfer.cpp:94:11: warning: extra tokens at end of #undef directive
94 | #undef BIT(x, i) (((x) >> (i)) & 1)
| ^
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)
| ^~~~~~~~~~~~~~| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |