# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
818266 | 2023-08-10T04:13:40 Z | LIF | Data Transfer (IOI19_transfer) | C++14 | 4 ms | 2492 KB |
#include "transfer.h" #include<bits/stdc++.h> using namespace std; int n; vector<int> get_attachment(vector<int> source) { int ans = 0; n = source.size(); int need = 0; int mul = 1; while(mul < n) { mul *= 2; need++; } for(int i=0;i<source.size();i++)if(source[i] == 1)ans ^= (i+1); vector<int> temp; for(int i=0;i<need;i++)temp.push_back(0); int nowbit = 0; while(ans > 0) { if(ans %2 == 0)temp[nowbit] = 0; else temp[nowbit] = 1; nowbit++; ans /= 2; } int kk = 0; vector<int> add; //for(int i=temp.size()-1;i>=0;i--)cout<<temp[i]<<" "; for(int i=temp.size()-1;i>=0;i--)add.push_back(temp[i]); for(int i=0;i<add.size();i++)kk ^= add[i]; add.push_back(kk); /*for(int i=0;i<source.size();i++)cout<<source[i]<<" "; cout<<endl;*/ return add; } vector<int> retrieve(vector<int> data) { /*cout<<data.size()<<endl; cout<<"data: ";*/ // for(int i=0;i<data.size();i++)cout<<data[i]; // cout<<endl; int temp = 0; for(int i=n;i<data.size()-1;i++)temp ^= data[i]; if(temp == data[data.size()-1]) // the part of ans1 has been changed. { int suxor = 0; int nowbit = 1; for(int i=data.size()-2;i>=n;i--) { if(data[i] == 1)suxor += nowbit; nowbit *= 2; } // cout<<suxor<<endl; vector<int> ans; for(int i=0;i<n;i++) { int thispos = 0; for(int j=0;j<n;j++)if(j!=i && data[j] == 1)thispos ^= (j+1); // cout<<i<<" 0 "<<thispos<<endl; if(thispos == suxor) { for(int k=0;k<n;k++) { if(k == i)ans.push_back(0); else ans.push_back(data[k]); } // for(int i=0;i<ans.size();i++)cout<<ans[i]; break; } thispos = (i+1); for(int j=0;j<n;j++)if(data[j] == 1 && j!= i)thispos ^= (j+1); // cout<<i<<" 1 "<<thispos<<endl; if(thispos == suxor) { for(int k=0;k<n;k++) { if(k == i)ans.push_back(1); else ans.push_back(data[k]); } /*for(int i=0;i<ans.size();i++)cout<<ans[i]; cout<<endl;*/ break; } } return ans; //cout<<"yeah"<<endl; } else { vector<int> ans; for(int i=0;i<n;i++)ans.push_back(data[i]); return ans; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 640 KB | WA in grader: wrong source retrieval |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2492 KB | WA in grader: wrong source retrieval |
2 | Halted | 0 ms | 0 KB | - |