Submission #863919

# Submission time Handle Problem Language Result Execution time Memory
863919 2023-10-21T12:44:22 Z hariaakas646 Mensza (COI22_mensza) C++17
0 / 100
5000 ms 143304 KB
#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) {
        string c;
        cin >> c;
        int a;
        cin >> a;
        if(c[0] == 'a') {
            vi out;
            frange(i, 10) {
                if(a & (1<<i)) {
                    frange(j, 2*i+1) out.pb(2*i+1);
                }
            }
            for(auto e : out) printf("%d ", e);
            printf("\n");
        }
        else if(c[0] == 'b') {
            vi out;
            frange(i, 10) {
                if(a & (1<<i)) {
                    frange(j, 2*i+2) out.pb(2*i+2);
                }
            }
            for(auto e : out) printf("%d ", e);
            printf("\n");
        }
        else {
            int v1 = 0;
            int v2 = 0;
            vi vec(a);
            frange(i, a) cin >> vec[i];
            for(auto e : vec) {
                if(e % 2) {
                    v1 += (1<<((e-1)/2));
                }
                else {
                    v2 += (1<<((e-2)/2));
                }
            }
            if(v1 > v2) printf("A\n");
            else printf("B\n");
        }
    }
}

Compilation message

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
1 Incorrect 21 ms 784 KB Wrong answer on query 1: expected B, found A
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2038 ms 3148 KB Wrong answer on query 1: expected B, found A
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5040 ms 143304 KB Time limit exceeded
2 Halted 0 ms 0 KB -