QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#59729#1366. Exam ManipulationBeevo#WA 429ms3652kbC++23853b2022-10-31 22:20:362022-10-31 22:20:38

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-31 22:20:38]
  • 评测
  • 测评结果:WA
  • 用时:429ms
  • 内存:3652kb
  • [2022-10-31 22:20:36]
  • 提交

answer

#include <bits/stdc++.h>

#define el '\n'
#define ll long long
#define ld long double

#define Beevo ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

void testCase() {
    int n, k;
    cin >> n >> k;

    string a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];

    int sol = 0;

    for (int msk = 0; msk < (1 << k); msk++) {
        int mn = 1e9;

        for (int i = 0; i < n; i++) {
            int curSol = 0;

            for (int bit = 0; bit < msk; bit++)
                curSol += (msk & (1 << bit) ? (a[i][bit] == 'T') : (a[i][bit] == 'F'));

            mn = min(mn, curSol);
        }

        sol = max(sol, mn);
    }

    cout << sol;
}

signed main() {
    Beevo

    int T = 1;
//    cin >> T;

    while (T--)
        testCase();

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3576kb

input:

1 1
T

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3568kb

input:

1 10
TFTFTFTFTF

output:

10

result:

ok single line: '10'

Test #3:

score: 0
Accepted
time: 429ms
memory: 3572kb

input:

1000 10
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTFTFTF
TFTFTF...

output:

10

result:

ok single line: '10'

Test #4:

score: -100
Wrong Answer
time: 428ms
memory: 3652kb

input:

1000 10
TFTFTFTFTF
FTFTFTFTFT
TFTFTFTFTF
FTFTFTFTFT
TFTFTFTFTF
FTFTFTFTFT
TFTFTFTFTF
FTFTFTFTFT
TFTFTFTFTF
FTFTFTFTFT
TFTFTFTFTF
FTFTFTFTFT
TFTFTFTFTF
FTFTFTFTFT
TFTFTFTFTF
FTFTFTFTFT
TFTFTFTFTF
FTFTFTFTFT
TFTFTFTFTF
FTFTFTFTFT
TFTFTFTFTF
FTFTFTFTFT
TFTFTFTFTF
FTFTFTFTFT
TFTFTFTFTF
FTFTFTFTFT
TFTFTF...

output:

10

result:

wrong answer 1st lines differ - expected: '5', found: '10'