Submission #795083

#TimeUsernameProblemLanguageResultExecution timeMemory
795083ono_de206Parrots (IOI11_parrots)C++14
17 / 100
4 ms1216 KiB
#include "encoder.h" #include "encoderlib.h" #include<bits/stdc++.h> using namespace std; #define in insert #define all(x) x.begin(),x.end() #define pb push_back #define eb emplace_back #define ff first #define ss second //#define int long long typedef long long ll; typedef vector<int> vi; typedef set<int> si; typedef multiset<int> msi; typedef pair<int, int> pii; typedef vector<pii> vpii; void encode(int n, int a[]) { int sum = 0; for(int i = 0; i < n; i++) { for(int j = 0; j < 4; j++) { int times = (a[i] >> (2 * j)) & 3; sum += times; } } bool did = 0; if(sum >= n * 6) { did = 1; for(int i = 0; i < 4; i++) { send(0); } } for(int i = 0; i < n; i++) { for(int j = 0; j < 4; j++) { int times = ((a[i] >> (2 * j)) & 3); if(did) times = 3 - times; for(int k = 0; k < times; k++) { send(i * 4 + j); } } } }
#include "decoder.h" #include "decoderlib.h" #include<bits/stdc++.h> using namespace std; #define in insert #define all(x) x.begin(),x.end() #define pb push_back #define eb emplace_back #define ff first #define ss second //#define int long long typedef long long ll; typedef vector<int> vi; typedef set<int> si; typedef multiset<int> msi; typedef pair<int, int> pii; typedef vector<pii> vpii; void decode(int n, int l, int x[]) { vector<int> cnt(256); for(int i = 0; i < l; i++) { cnt[x[i]]++; } bool did = 0; if(cnt[0] >= 4) { did = 1; cnt[0] -= 4; } for(int i = 0; i < n; i++) { int ans = 0; for(int j = 0; j < 4; j++) { if(did) cnt[i * 4 + j] = 3 - cnt[i * 4 + j]; ans |= ((cnt[i * 4 + j] ^ did) << (j * 2)); } output(ans); } }
#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...