QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#857303 | #9736. Kind of Bingo | Wzy# | TL | 0ms | 3712kb | C++14 | 997b | 2025-01-15 15:20:11 | 2025-01-15 15:20:22 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const int N=5e5+10,M=2*N;
//const int mod=998244353;
const LL mod=1e9+7;
const LL INF=1e18+7;
//LL h[N],e[M],ne[M],idx
int p[128];
int find(int x){
if(x!=p[x]) p[x]=find(p[x]);
return p[x];
}
void solve(){
int n,m,k;
cin>>n>>m>>k;
unordered_map<int,int> mp;
if(k>=m){
cout<<m<<endl;
return;
}
for(int i=1;i<=n*m;i++){
int x;
cin>>x;
mp[x]=i;
}
int res=1e9;
for(int i=1;i<=n;i++){
vector<int> tmp;
for(int j=1;j<=m;j++) tmp.push_back(mp[(i-1)*m+j]);
sort(tmp.begin(),tmp.end());
res=min(res,tmp[m-k-1]);
}
if(res<m) res=m;
cout<<res<<endl;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T=1;
cin>>T;
while(T--) solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
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
Time Limit Exceeded
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 10 2 1 7 6 3 1 5 4 1 1 3 1 6 5 9 6 2 5 10 2 1 6 1 4 2 6 6 1 5 7 10 1 1 1 4 8 1 1 5 3 2 9 5 10 1 1 3 4 6 2 2 2 5 1 1 2 1 1 4 2 1 6 5 4 4 0 1 1 1 1 1 6 4 6 1 1 1 6 4 2 1 2 2 4 3 6 3 5 10 7 4 3 2 3 3 4 3 2 6 3 6 2 6 9 10 2 6 2 1 2 3 7 3 2 7 9 3 4 4 5 6 3 7 6 4 2 6 5 2 1 2 8 7 6 6 6 5 3 7 6 1...