Submission #799276

#TimeUsernameProblemLanguageResultExecution timeMemory
799276LiudasParrots (IOI11_parrots)C++17
52 / 100
2 ms1052 KiB
#include <bits/stdc++.h> #include "encoder.h" #include "encoderlib.h" //#include "decoder.h" //#include "decoderlib.h" using namespace std; void encode(int N, int M[]){ for(int i = 0; i < N; i ++){ send(M[i]); send(M[i]); } vector<int> arr; for(int i = 0; i < N; i ++){ arr.push_back(M[i]); } sort(arr.begin(), arr.end()); for(int i = 0; i < N; i ++){ for(int j = 0; j < N; j ++){ if(arr[j] == M[i]){ send(i * 16 + j); M[i] = -1; break; } } } }
#include <bits/stdc++.h> //#include "encoder.h" //#include "encoderlib.h" #include "decoder.h" #include "decoderlib.h" using namespace std; void decode(int N, int L, int X[]){ map<int, int> arr; for(int i = 0; i < L; i++){ arr[X[i]]++; } vector<int> ord, ans(N), brr; for(auto[l, r] : arr){ for(int i = 0; i < r/2; i ++){ brr.push_back(l); } if(r % 2){ ord.push_back(l); } } for(int k : ord){ int i = k / 16, j = k % 16; ans[i] = brr[j]; } for(int i : ans){ output(i); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...