QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#785782 | #9736. Kind of Bingo | xyggzsf# | WA | 4ms | 5732kb | C++14 | 1.5kb | 2024-11-26 19:11:03 | 2024-11-26 19:11:04 |
Judging History
answer
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
#define int long long
typedef pair<int, int>pii;
typedef pair<char, int>pci;
typedef pair<int, pii>piii;
const int mod = 998244353;
const int N = 5e5 + 100;
int ksm(int a, int b) { if (a == 0 && b == 0)return 1; int ans = 1; while (b) { if (b % 2)ans = (ans * a) % mod; a = (a * a) % mod; b >>= 1; }return ans; }
int sqrtt(int x) { int l = 0, r = 3e9; while (l < r) { int mid = (l + r + 1) >> 1; if (mid * mid == x)return mid; else if (mid * mid > x)r = mid - 1; else l = mid; }return l; }
int p[200010];
int cnt[200010];
int n, m, k;
bool check(int x)
{
for (int i = 1; i <= n; i++)cnt[i] = 0;
for (int i = 1, tot = 0; i <= n && tot < x; i++)
{
for (int j = 1; j <= m && tot < x; j++,tot++)
{
cnt[p[(i - 1) * m + j] / m + 1]++;
}
}
int mn = 1e8;
for (int i = 1; i <= n; i++)
{
if (mn > m - cnt[i])
{
mn = m - cnt[i];
}
}
return mn <= k;
}
void solve()
{
cin >> n >> m >> k;
for (int i = 1; i <= n; i++)for (int j = 1; j <= m; j++)cin >> p[(i - 1) * m + j];
int l = m, r = n * m;
while (l < r)
{
int mid = l + r >> 1;
if (!check(mid))l = mid + 1;
else r = mid ;
}
cout << l << endl;
return;
}
signed main()
{
ios::sync_with_stdio(0); cout.tie(0); cin.tie(0);
int t = 1;
cin >> t;
while (t--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5732kb
input:
3 3 5 2 1 4 13 6 8 11 14 2 7 10 3 15 9 5 12 2 3 0 1 6 4 3 5 2 2 3 1000000000 1 2 3 4 5 6
output:
7 5 3
result:
ok 3 number(s): "7 5 3"
Test #2:
score: -100
Wrong Answer
time: 4ms
memory: 5676kb
input:
10000 1 9 7 8 9 1 5 3 7 4 6 2 1 8 2 7 5 1 6 4 2 3 8 1 1 0 1 1 8 3 5 7 8 3 2 1 4 6 1 10 948645336 3 10 1 6 2 8 9 5 7 4 1 1 0 1 1 10 7 5 3 10 8 1 7 4 9 6 2 1 9 6 4 8 5 7 2 6 3 1 9 1 7 1 3 5 1 6 2 7 4 1 6 6 5 3 1 2 4 6 1 1 1 1 1 2 0 1 2 1 1 1 1 1 6 3 5 6 2 4 3 1 1 5 673454194 2 3 1 4 5 1 4 1 1 4 2 3 1 ...
output:
9 8 1 8 10 1 10 9 7 6 1 2 1 6 5 4 1 7 3 3 6 8 9 10 5 6 2 10 4 2 5 7 10 1 4 1 3 9 1 2 4 3 10 5 5 2 5 6 9 5 10 1 7 5 2 2 7 1 2 9 8 9 1 6 6 2 2 1 2 6 4 6 1 2 6 4 2 3 4 7 3 4 1 6 3 5 10 7 4 1 10 3 4 2 6 10 1 8 4 9 9 10 4 6 3 3 6 2 2 6 6 10 7 7 1 3 2 7 9 3 4 4 5 6 3 7 5 6 5 5 8 2 6 6 9 7 7 10 8 1 1 10 7 ...
result:
wrong answer 2011th numbers differ - expected: '4', found: '6'