/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 520.0 KiB
#2 Wrong Answer 2ms 532.0 KiB
#3 Wrong Answer 7ms 620.0 KiB
#4 Wrong Answer 7ms 624.0 KiB
#5 Wrong Answer 12ms 628.0 KiB
#6 Wrong Answer 102ms 744.0 KiB
#7 Time Exceeded ≥1090ms ≥1.219 MiB
#8 Time Exceeded ≥1088ms ≥1.902 MiB
#9 Time Exceeded ≥1091ms ≥2.617 MiB
#10 Wrong Answer 244ms 1.406 MiB
#11 Wrong Answer 248ms 1.418 MiB

Code

/*
 *Copyright (c) Swadheen Islam Robi (SIR01)
 *Created on Thu Sep 05 2024 10:19:08 PM
 */

#include <iostream>
#include <vector>

using namespace std;

int solve(int N, int K) {
    vector<int> A(N, 0);
    int mon = min(K, N);

    for (int i = 0; i < mon; i++) {
        A[i] = 1;
    }

    int X = K - mon;
    for (int i = mon; i < N && X > 0; i++) {
        A[i] = 1;
        X--;
    }

    int Y = 1;
    for (int i = 0; i < N; i++) {
        Y &= A[i];
    }

    return X * Y;
}

int main() {
    int T;
    cin >> T;

    while (T--) {
        int N, K;
        cin >> N >> K;

        int ans = solve(N, K);
        cout << ans << endl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1092 Bitwise AND
Contest
Brain Booster #5
Language
C++20 (G++ 13.2.0)
Submit At
2024-09-05 17:19:55
Judged At
2024-10-03 13:04:39
Judged By
Score
1
Total Time
≥1091ms
Peak Memory
≥2.617 MiB