QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#394649#1366. Exam ManipulationZuqa#AC ✓36ms3884kbC++201.7kb2024-04-20 17:12:422024-04-20 17:12:44

Judging History

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

  • [2024-04-20 17:12:44]
  • 评测
  • 测评结果:AC
  • 用时:36ms
  • 内存:3884kb
  • [2024-04-20 17:12:42]
  • 提交

answer

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define el '\n'
#define FIO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned uint;
typedef __int128 bint;
typedef long double ld;
typedef complex<ld> pt;
typedef unsigned long long ull;

template<typename T, typename X>
using hashTable = gp_hash_table<T, X>;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

// mt19937_64 for unsigned long long
#define el "\n"
mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());
const int mod = 998244353, N = 1e5 + 5;
char gr[1005][13];
int n, k, ans;

int get(string key)
{
    int cur = 1e9, cnt = 0;
    for(int i = 1; i <= n; i++)
    {
        cnt = 0;
        for(int j = 0; j < k; j++)
        {
            if(gr[i][j] == key[j])
            {
                cnt++;
            }
        }
        cur = min(cur, cnt);
    }
    return cur;
}

void solve(string key)
{
    if(key.size() == k)
    {
        ans = max(ans, get(key));
        return;
    }
    solve(key + 'T');
    solve(key + 'F');
    return;
}

void doWork()
{
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 0; j < k; j++)
        {
            cin >> gr[i][j];
        }
    }
    solve("");
    cout << ans << el;
}

signed main()
{
    FIO
    int T = 1;
//    cin >> T;
    for(int i = 1; i <= T; i++)
        doWork();
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3644kb

input:

1 1
T

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

1 10
TFTFTFTFTF

output:

10

result:

ok single line: '10'

Test #3:

score: 0
Accepted
time: 4ms
memory: 3656kb

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: 0
Accepted
time: 4ms
memory: 3732kb

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:

5

result:

ok single line: '5'

Test #5:

score: 0
Accepted
time: 23ms
memory: 3820kb

input:

1000 10
FFFFFFFFFF
TFFFFFFFFF
TFFFFFFFFF
TTFFFFFFFF
TFFFFFFFFF
TFTFFFFFFF
TTFFFFFFFF
TTTFFFFFFF
TFFFFFFFFF
TFFTFFFFFF
TFTFFFFFFF
TFTTFFFFFF
TTFFFFFFFF
TTFTFFFFFF
TTTFFFFFFF
TTTTFFFFFF
TFFFFFFFFF
TFFFTFFFFF
TFFTFFFFFF
TFFTTFFFFF
TFTFFFFFFF
TFTFTFFFFF
TFTTFFFFFF
TFTTTFFFFF
TTFFFFFFFF
TTFFTFFFFF
TTFTFF...

output:

2

result:

ok single line: '2'

Test #6:

score: 0
Accepted
time: 35ms
memory: 3660kb

input:

1000 10
TTTFTFTFFT
TTTTFTFTFF
TTTTFFTTFF
TTTFFTTTFF
TFTTTFTTFF
TFTTFFFFFF
TTTTTFFFFF
TFFFFTTTFF
TTFTFFFFTF
TTTFTFTFTF
TTFTFFFTTT
TFTTTTFFFT
TTTFFTFFTF
TTTFFFTTFT
TTFTFFFTFT
TFTFFTFTTF
TTTTTTFFFF
TFTTFTTTTF
TTTTFFTFFF
TTTTFFTFTF
TTFFFFTFFF
TFTTTTTFFF
TFFFTFTFFF
TFFFTFFTFF
TFFFFTTTTF
TFFFFTFFTF
TFFTTT...

output:

2

result:

ok single line: '2'

Test #7:

score: 0
Accepted
time: 35ms
memory: 3736kb

input:

1000 10
TTFTTFFTFT
TTFFTTTTFF
TTTFFFFTFF
TTFFFTTTTT
TTTFTTTTFT
TFTFFTFTFF
TTTFTFFTFF
TFTTFFTFTT
TFTTTTTFFF
TTTFTFTFTF
TTFTTFTTTT
TTFFTFFFFF
TTTFFFTFFT
TFFTTFFFTF
TTFTTFFFFT
TFTFFFTFFF
TTFFTTFFFF
TFFTFTFTFF
TFTFTFTTFF
TFFTFTFTFF
TTFFFTTFTF
TFFFTFFTTF
TTTFFFTTFF
TFTTFFFTFF
TTFTFTFFFT
TTTFFTFFFF
TFFFTF...

output:

2

result:

ok single line: '2'

Test #8:

score: 0
Accepted
time: 36ms
memory: 3616kb

input:

1000 10
TTFTFTTTTF
TFFTFFFTFF
TFTFFTFTTF
TTTFTFFFFT
TFFFTFFFFF
TTTTTTFFTF
TFTTTFFTFF
TTTTFFFFFF
TTTFTTTFTF
TFFFTFFFTT
TFFTFFFFFF
TFTTFFTFFF
TTFFFTFFFT
TTTFFTFFFF
TFFTTFTTTF
TTTTFFFFFF
TFTTFTFTTF
TFFTTFTTFF
TTTTFFFTTF
TTTTTFFTFF
TTTFFFFFFF
TTTFTTFFFF
TFFFTTFFTF
TFFFTTTTFF
TFTTFTTFTF
TFTTTFFTFF
TFFTFF...

output:

2

result:

ok single line: '2'

Test #9:

score: 0
Accepted
time: 35ms
memory: 3636kb

input:

1000 10
TTTFFTTTTF
TFFFFFFTTT
TFFFTFFFFF
TTFFTFFTFF
TTTTFFFFFT
TTFTFFFFFF
TTFFTTTTTT
TFFFTFFFTF
TFFTFFTFTF
TFTTTFTTFF
TTTFFFTFFF
TFTTFTFTFF
TTFFTFFFTT
TFTFTFFFFF
TTTTFFTTTF
TFTTTFFTTF
TTTTTTFTTF
TFTFTFTTFF
TFTFTFFTTT
TTTTTFFTTT
TTFFTFTFTF
TTTTFFTTFF
TTTTFTFFFF
TFTTFTFFFF
TFTTFTFTFF
TTFTTTTFTF
TFFTFT...

output:

2

result:

ok single line: '2'

Test #10:

score: 0
Accepted
time: 35ms
memory: 3860kb

input:

1000 10
TTTTFTTTFT
TTFTTFTFTT
TFTTFTTTTF
TTTTTFFFTF
TFTFFTTTTF
TFFTTFTTFF
TFFTTTTFFF
TTFTFFFTTT
TFTFFFTTFF
TTTFFFFTFT
TTTTFTTFFF
TTFTFFFFFF
TTFFFTFFFT
TFTFTFTFFT
TFFTFFTTTF
TTFFTTFTFF
TTTTTFTFTF
TFFFTTFFFF
TTFTTTTFTF
TTFTFFFFFF
TTTTTFFTTF
TTTFFFFFFF
TTTFFTTFFT
TFTFFFFFTF
TFTTFFFTFT
TFTTFTTFFT
TFFFFF...

output:

2

result:

ok single line: '2'

Test #11:

score: 0
Accepted
time: 7ms
memory: 3632kb

input:

956 8
TFTFFFTF
TTTTFTTT
TTTTFTFT
TTTFTTFT
TTTTTTFT
TFFTTTTT
TTFFFTTF
TFFFFFTT
TFTTFTFT
TFFTFFFF
TFFFTTTF
TFFFFTTF
TTTFTTFF
TTTTFFFF
TFTFFFFT
TFFFFFFT
TTTTTTFT
TTFFFFTT
TFFTTTTT
TFTFTTTF
TTFTFFFF
TTTTFFFT
TTFFTTFF
TFTFFTTT
TFTFFTFF
TTTTTFTF
TFTFFTFF
TFFFTFTT
TTFTTTFF
TFFTTFTF
TFTTTTFF
TFTTFFFT
TFFTTF...

output:

1

result:

ok single line: '1'

Test #12:

score: 0
Accepted
time: 3ms
memory: 3648kb

input:

449 8
TFTTTTFF
TFTTFTFF
TFTFTTTF
TFFFFFFF
TFFTFFTT
TFFFTTFF
TFTTFTFF
TFFFTTFF
TFFFFFFT
TTFTFFFF
TFTTFTTT
TFTTTTFF
TFTFTFFF
TTFTTTFF
TFTFTTFF
TFTFTTTF
TFTFTFTT
TFTFTFTF
TFTTTFTF
TFTFFTFF
TFTFTTTF
TFTFTFFF
TTFTFTTF
TTFTTFFT
TFFTFTFF
TFTFFTTF
TFTTTTTF
TFFFTFFF
TFTFTTFF
TFFFFFTF
TFFTTTFF
TTFTTFTF
TFFFFF...

output:

2

result:

ok single line: '2'

Test #13:

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

input:

866 6
TFTFTT
TTFTTF
TFTFFT
TTFFTF
TFFFTT
TFTTTF
TTFTTF
TFTTFF
TFFTTF
TTTTTF
TTFTFF
TTTFFT
TTTFTF
TFTFFF
TTFFTF
TTTFFF
TTFFTF
TTFFTF
TFFFTT
TTFTTF
TFTFFF
TTTFFF
TFFFFT
TFTTFF
TFFFFT
TTFFTF
TTFTFF
TTTTFT
TFTFTF
TTFTFT
TFFTTT
TFTFTT
TFTTFT
TTTTFT
FFFFFF
TTTFTT
TTTFFF
TFFFTF
TTTTTF
TFTFFF
TFTTFT
TFFFFT
...

output:

1

result:

ok single line: '1'

Test #14:

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

input:

630 7
TTFTTFF
TFTFFTF
TTFTFTF
TFFTFTF
TFTFFTT
TTTTTTT
TTFTTTT
TFTFTFT
TFTTTTT
TFTFFFF
TFFFFFF
TFFTFTT
TTTTFTT
TTFFTFT
TTTTFFT
TTFFFFF
TFTFTFF
TTTTTFF
TTTFTTF
TFFFTFF
TTTFTTF
TTFFTFT
TFTTFFF
TFTFTFF
TTFTFFF
TFTTFFT
TTTFTTT
TFTTFFT
TTFTFFT
TTTTFTF
TFFTTFF
TTFTTTT
TTFTFFT
TFTFTTF
TTTFTTT
TTFFTTF
TTTTTT...

output:

1

result:

ok single line: '1'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

751 7
TTFFFFT
TTTTTFT
TTFTFFT
TTFFFTT
TFFTFTT
TTFTFTT
TTFFFFT
TTTTTTT
TTTTFTF
TTFTFFF
TFFFFFF
TTTFFTF
TFTFFTF
TTFFFFT
TFFFFFT
TFFTFFT
TTTTTTF
TFFTTFT
TTTFFFT
TTTTTFT
TFFTFFF
TTTFFTF
TFTFTFF
TFFTTFF
TTTFFFF
TFFFFTT
TTTFFFT
TTFTTFT
TFTFFTF
TTFFFFT
TFFFFFF
TTFTTFT
TFTTTFT
TFFFTTF
TFTFTFF
TTTTTTT
TTTTTF...

output:

1

result:

ok single line: '1'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

2 1
T
F

output:

0

result:

ok single line: '0'