# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
829879 | 2023-08-18T15:33:29 Z | Essa2006 | Data Transfer (IOI19_transfer) | C++14 | 239 ms | 2492 KB |
#include "transfer.h" #include<bits/stdc++.h> using namespace std; vector<int> get_attachment(vector<int> source) { vector<int>Ans; for(int j=0;j<=9;j++){ int cur=(1<<j); int res=0; bool cont=0; for(int i=0;i<source.size();i++){ if((i+1)&cur){ cont=1; res^=source[i]; } } if(!cont) continue; Ans.push_back(res); } int res=0; for(int i=0;i<Ans.size();i++){ res^=Ans[i]; } Ans.push_back(res); return Ans; } vector<int> retrieve(vector<int> data) { int ind=0; int n=63; if(data.size()>200){ n=255; } vector<int>Cur(n); for(int j=0;j<=9;j++){ int cur=(1<<j); int res=0; bool cont=0; for(int i=0;i<n;i++){ if((i+1)&cur){ cont=1; res^=data[i]; } } if(!cont) continue; Cur.push_back(res); } int res=0; for(int i=n;i<data.size()-1;i++){ res^=data[i]; if(Cur[i]!=data[i]){ ind+=(1<<(i-n)); } } vector<int>Ans; for(int i=0;i<n;i++){ Ans.push_back(data[i]); } if(ind && res!=data.back()){ ind=0; } if(ind){ Ans[ind-1]=!Ans[ind-1]; } if(Ans.size()!=n) n/=0; return Ans; } //static inline string run_scenario() { // int c; // cin >> c; // if (c < -1) // return "invalid corruption index"; // string source_str; // cin >> source_str; // const int N = source_str.size(); // const int max_attachment_size = 2*N; // vector<int> source; // for (int i=0; i<N; i++) // source.push_back(source_str[i]-'0'); // // vector<int> attachment = get_attachment(source); // if (int(attachment.size()) > max_attachment_size) // return "attachment too large"; // for (int x : attachment) // if (x != 0 && x != 1) // return "invalid attachment integer value"; // // vector<int> data(source); // data.insert(data.end(), attachment.begin(), attachment.end()); // // if (c >= int(data.size())) // return "invalid corruption index"; // // if (c >= 0) // data[c] = 1-data[c]; // // vector<int> result_source = retrieve(data); // // if (source != result_source) // return "wrong source retrieval"; // // return string("OK K=")+to_string(attachment.size()); //} // //int main() { // int T; // cin >> T; // for (int scenario = 0; scenario < T; scenario++) { // string result = run_scenario(); // cout << "scenario #" << scenario << ": " << result << endl; // } // return 0; //}
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 648 KB | Output is correct |
2 | Correct | 5 ms | 652 KB | Output is correct |
3 | Correct | 4 ms | 788 KB | Output is correct |
4 | Correct | 5 ms | 732 KB | Output is correct |
5 | Correct | 5 ms | 812 KB | Output is correct |
6 | Correct | 5 ms | 652 KB | Output is correct |
7 | Correct | 5 ms | 644 KB | Output is correct |
8 | Correct | 7 ms | 736 KB | Output is correct |
9 | Correct | 5 ms | 652 KB | Output is correct |
10 | Correct | 5 ms | 732 KB | Output is correct |
11 | Correct | 5 ms | 652 KB | Output is correct |
12 | Correct | 5 ms | 812 KB | Output is correct |
13 | Correct | 5 ms | 644 KB | Output is correct |
14 | Correct | 5 ms | 648 KB | Output is correct |
15 | Correct | 5 ms | 644 KB | Output is correct |
16 | Correct | 5 ms | 648 KB | Output is correct |
17 | Correct | 5 ms | 644 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 190 ms | 2492 KB | Output is correct |
2 | Correct | 193 ms | 2492 KB | Output is correct |
3 | Correct | 193 ms | 2492 KB | Output is correct |
4 | Correct | 190 ms | 2484 KB | Output is correct |
5 | Correct | 198 ms | 2464 KB | Output is correct |
6 | Correct | 239 ms | 2492 KB | Output is correct |
7 | Correct | 189 ms | 2484 KB | Output is correct |
8 | Correct | 189 ms | 2492 KB | Output is correct |
9 | Correct | 194 ms | 2484 KB | Output is correct |
10 | Correct | 189 ms | 2488 KB | Output is correct |
11 | Correct | 222 ms | 2484 KB | Output is correct |
12 | Correct | 195 ms | 2484 KB | Output is correct |
13 | Correct | 190 ms | 2484 KB | Output is correct |
14 | Correct | 209 ms | 2492 KB | Output is correct |
15 | Correct | 191 ms | 2484 KB | Output is correct |
16 | Correct | 190 ms | 2492 KB | Output is correct |
17 | Correct | 194 ms | 2488 KB | Output is correct |
18 | Correct | 189 ms | 2484 KB | Output is correct |
19 | Correct | 196 ms | 2484 KB | Output is correct |