QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#775647#9736. Kind of BingozqxRE 1ms3792kbC++20755b2024-11-23 16:23:432024-11-23 16:23:49

Judging History

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

  • [2024-11-23 16:23:49]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:3792kb
  • [2024-11-23 16:23:43]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
using namespace std;
void paralysis(){
	int n,m,k;
	cin>>n>>m>>k;
	if (k>=m){
		cout<<m<<"\n";
		return;
	}
	
	vector<vector<int>> a(n+5,vector<int>(m+5));
	for (int i=1;i<=n*m;i++){
		int res;
		cin>>res;
		int x=(res-1)/m+1;
		int y=res-(x-1)*m;
		a[x][y]=i;
	}
	
	int ans=n*m;
	for (int i=1;i<=n;i++){
		sort(a[i].begin()+1,a[i].begin()+1+m);
		ans=min(ans,max(m,a[i][m-k]));
	}
	cout<<ans<<"\n";
}
/*
 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
 
 1
 2 3 0
 1 6 4 3 5 2
*/
int main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
    
    int t=1;
    cin>>t;
	while (t--){
		paralysis();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3792kb

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
Runtime Error

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:


result: