# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
785972 | Cyber_Wolf | 앵무새 (IOI11_parrots) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Problem: P6 - Parrots
// Contest: DMOJ - IOI '11
// URL: https://dmoj.ca/problem/ioi11p6
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace __gnu_pbds;
#define lg long long
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int g[160], id;
void encode(int N, int M[])
{
int b = 0;
for(int i = 0; i < N; i++)
{
for(int j = 0; j < 8; j++)
{
if(!((1ll << j)&M[i])) continue;
b++;
lg x = (i << 3)+j;
send(x);
// g[id++] = x;
// for(int k = 10; k >= 0; k--)
// {
// if((1ll << k)&x) cout << 1;
// else cout << 0;
// }
// cout << '\n';
}
// cout << '\n';
}
if(!b)
{
while(N--)
{
send(0);
// g[id++] = 0;
}
}
}
// Problem: P6 - Parrots
// Contest: DMOJ - IOI '11
// URL: https://dmoj.ca/problem/ioi11p6
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace __gnu_pbds;
#define lg long long
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
bool cmp(int a, int b)
{
return a < b;
}
void decode(int N, int L, int X[])
{
sort(X, X+L);
if(!X[L-1])
{
while(L--)
{
output(0);
// cout << "0\n";
}
return;
}
int la = -1;
for(int i = 0; i < L; )
{
int j = i;
lg o = 0;
if((X[i] >> 3)-la > 1)
{
int diff =(X[i] >> 3)-la-1;
while(diff--)
{
output(0);
// cout << "0\n";
}
}
la = (X[i] >> 3);
while(j < L)
{
if((X[j] >> 3) != (X[i] >> 3))
{
break;
}
o += (1 << (X[j]&7));
j++;
}
i = j;
// cout << o << '\n';
output(o);
}
}