답안 #863922

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
863922 2023-10-21T12:51:40 Z hariaakas646 Mensza (COI22_mensza) C++17
0 / 100
5000 ms 149292 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);
                }
            }
            printf("%d ", (int)out.size());
            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);
                }
            }
            printf("%d ", (int)out.size());
            for(auto e : out) printf("%d ", e);
            printf("\n");
        }
        else {
            int v1 = 0;
            int v2 = 0;
            vi vec(a);
            frange(j, 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);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 720 KB Wrong answer on query 1: expected B, found A
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 48 ms 1496 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5046 ms 149292 KB Time limit exceeded
2 Halted 0 ms 0 KB -