This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define scd(t) scanf("%d", &t)
#define sclld(t) scanf("%lld", &t)
#define forr(i, j, k) for (int i = j; i < k; i++)
#define frange(i, j) forr(i, 0, j)
#define all(cont) cont.begin(), cont.end()
#define mp make_pair
#define pb push_back
#define f first
#define s second
typedef long long int lli;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<lli> vll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mpii;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef long double ld;
void usaco()
{
freopen("/media/hariaakash646/785EF1075EF0BF46/CompetitiveProgramming/input.in", "r", stdin);
// freopen("problem.out", "w", stdout);
}
int main() {
// usaco();
int l, q;
cin >> l >> q;
frange(i, q) {
char c;
cin >> c;
char v = c;
int a;
frange(i, 7) cin >> v;
cin >> a;
// printf("%d\n", a);
if(c == 'a') {
vi out;
frange(i, 10) {
if(a & (1<<i)) {
frange(j, 2*i+1) out.pb(2*i+1);
}
}
printf("%d ", (int)out.size());
for(auto e : out) printf("%d ", e);
printf("\n");
}
else if(c == 'b') {
vi out;
frange(i, 10) {
if(a & (1<<i)) {
frange(j, 2*i+2) out.pb(2*i+2);
}
}
printf("%d ", (int)out.size());
for(auto e : out) printf("%d ", e);
printf("\n");
}
else {
int b = 0;
int c = 0;
vi vec(a);
frange(j, a) cin >> vec[j];
// for(auto e : vec) printf("%d ", e);
for(int e : vec) {
if(e % 2) {
b = b | (1LL<<((e-1)/2));
// printf("%d %d %d\n", e, (1<<((e-1)/2)), b);
}
else {
c = c | (1LL<<((e-2)/2));
// printf("%d %d %d\n", e, (1<<((e-1)/2)), c);
}
}
// printf("%d %d\n", b, c);
if(b > c) printf("A\n");
else printf("B\n");
}
}
}
Compilation message (stderr)
Main.cpp: In function 'void usaco()':
Main.cpp:30:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
30 | freopen("/media/hariaakash646/785EF1075EF0BF46/CompetitiveProgramming/input.in", "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |