QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#748138#9736. Kind of Bingoshenchuan_fanWA 5ms3828kbC++201.0kb2024-11-14 19:28:082024-11-14 19:28:08

Judging History

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

  • [2024-11-14 19:28:08]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:3828kb
  • [2024-11-14 19:28:08]
  • 提交

answer

/**/
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
using namespace std;
using LL = long long;
typedef pair<int, int> PII;
const int N = 1e7 + 10, M = 5010, mod = 998244353;
const int inf = 1e9;
void solve() {
	int n, m, k;
	cin >> n >> m >> k;
	vector <int> a(n * m + 1);
	vector <vector<int>> row(n + 1);
	for(int i = 1; i <= n * m; i++){
		cin >> a[i];
		int p = (a[i] + m - 1) / m;
		if(row[p].size() < m - k) row[p].push_back(i);
	}
	/*for(int i = 1; i <= n; i++){
		for(auto u : row[i]){
			cout << u << " ";
		}
		cout << '\n';
	}*/
	int ans = inf;
	if(k >= m - 1) ans = m;
	for(int i = 1; i <= n; i++){
		int blank = 0, pre = 1;
		for(int j = 0; j < row[i].size(); j++){
			blank += row[i][j] - pre;
			pre = row[i][j];
		}
		int cost = 0;
		if(blank >= k) cost = pre;
		else{
			cost += k - blank + pre;
		}  
		ans = min(ans, cost);
	}
	cout << ans << "\n";
} 
signed main() {
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int T = 1;
	cin >> T;
	while(T--) {
		solve();
	}
}

详细

Test #1:

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

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: 5ms
memory: 3828kb

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:

8
6
1
5
10
1
8
7
6
6
1
2
1
4
5
3
1
5
3
3
6
5
9
10
3
6
2
10
3
2
4
5
6
1
3
1
3
9
1
2
4
2
8
4
3
2
5
6
9
4
7
1
6
5
2
2
7
1
2
6
8
7
1
5
6
2
2
1
2
4
4
4
1
2
6
4
2
3
4
7
2
3
1
6
2
3
8
6
4
1
8
2
4
2
5
7
1
5
4
6
9
6
4
4
2
3
6
2
2
6
6
10
7
6
1
3
2
5
8
3
4
4
5
6
2
7
5
5
5
3
6
2
6
4
7
4
7
8
8
1
1
9
5
7
3
10
4
8...

result:

wrong answer 1st numbers differ - expected: '9', found: '8'