当前位置:网站首页>P5594 [xr-4] simulation match
P5594 [xr-4] simulation match
2022-07-07 23:40:00 【Yuesi】
subject
X The school is in progress CSP Before the school training .
Altogether n name OIer Participate in this training , The coach carefully prepared for them m Set of simulation questions .
However , Each OIer Each has its own schedule , Coincidentally, , They are in the next k There happens to be m I'm free to play a mock race .
For the convenience of management , The coach stipulated that one must finish the game in order m Set of simulation questions .
such as , Small X In the next 2,3,5 I'm free to play a mock race , Then he must be in the 2 Tiandadi 1 Set of simulation questions , The first 3 Tiandadi 2 Set of simulation questions , The first 5 Tiandadi 3 Set of simulation questions .
The coach needs to prepare everyone for every practice match , In order to reduce the workload , If there are many people playing the same set of simulation questions on a certain day , Then the coach only needs to prepare a simulation match using this set of questions on this day .
As a computer room boss , The coach wants you to help him calculate , How many practice matches does he need to prepare every day
Input format
The first row has three integers n,m,k.
Next n That's ok , Each row m It's an integer , The first i Xing di j Integer of column ai,j
It means the first one i Personal in the next k The second day of the day j The first free day is ai,j God .
Output format
a line k It's an integer , The first i An integer represents the next i The number of simulated games the coach needs to prepare .
I/o sample
Input #1
1 3 5
2 3 5
Output #1
0 1 1 0 1
Input #2
6 3 7
2 3 4
2 5 7
3 5 7
1 3 5
5 6 7
1 2 3
Output #2
1 2 3 1 3 1 1
Input #3
10 10 20
2 3 4 8 9 11 12 16 17 18
2 3 6 10 12 13 14 15 19 20
1 3 7 10 11 13 14 15 17 19
1 2 4 6 7 9 15 17 19 20
2 3 5 6 9 11 14 16 19 20
1 2 3 8 9 10 11 12 15 19
1 4 6 7 9 12 13 17 18 19
1 7 8 9 10 11 13 15 18 20
1 5 6 7 8 9 13 16 18 19
4 5 7 10 11 13 14 17 18 20
Output #3
1 2 2 3 2 2 4 3 3 3 3 4 2 1 3 1 2 2 2 1
explain / Tips
This question adopts the bundling test .
Subtask 1(13 points):n = m = k = 1.
Subtask 2(24 points):n = 1.
Subtask 3(24 points):m = 1.
Subtask 4(39 points): No special restrictions .
about 100%100% The data of ,1 ≤ n,m,k<=10^3 ,m≤k,
1 ≤ai,1 <ai,2<⋯<a i,m≤k.
Ideas :
You can use grouping by test paper , The same column of read data indicates different test days for the same test paper ,
Just record the first occurrence of each column of days
For example, data 2 Enter the first column ( The number of days for the first set of examination papers is 1,2,3,5,6) Then this 5 At least one exam will be held every day, with one exam paper
The second column records the date of the second set of papers
#include<bits/stdc++.h>
using namespace std;
int main(){
int ans[1005][1005];
int ka[1005],num=0;
int n,m,k;//n personal ,m Empty days , in total k God
scanf("%d%d%d",&n,&m,&k);
for(int i=1;i<=n;i++){
for(int h=1;h<=m;h++){
scanf("%d",&ans[i][h]);// Save to array , Easy to count
}
}
bool b[1005]={
0};// See if there has been the same exam on the same day
int bn[1005]={
0};// Record 1-k On the same day of each day, the number of different examination papers
for(int i=1;i<=m;i++){
num=0;
for(int h=1;h<=n;h++){
if(b[ans[h][i]]==0){
bn[ans[h][i]]++;
b[ans[h][i]]=1;
ka[num]=ans[h][i];// Used for restoring and weight removal b[1000]
num++;
}
}
/* for(int i=1;i<=k;i++){ printf("%d",bn[i]); if(i<k){ printf(" "); } } printf("\n");*/ // Used to check the results or observe whether each step is correct
for(int j=0;j<num;j++){
b[ka[j]]=0;// Restore the de duplicated array
}
}
for(int i=1;i<=k;i++){
// Output final results , Note blank space
printf("%d",bn[i]);
if(i<k){
printf(" ");
}
}
return 0;
}
边栏推荐
- gorm 关联关系小结
- 8.31 Tencent interview
- C inheritance and interface design polymorphism
- Solution of intelligent supply chain collaboration platform in electronic equipment industry: solve inefficiency and enable digital upgrading of industry
- Possible SQL for Oracle table lookup information
- c—线性表
- Class C design questions
- SAP HR family member information
- C语言学习
- How to change the formula picture in the paper directly into the formula in word
猜你喜欢
Ora-01741 and ora-01704
ESP at installation esp8266 and esp32 versions
二叉排序树【BST】——创建、查找、删除、输出
Senior programmers must know and master. This article explains in detail the principle of MySQL master-slave synchronization, and recommends collecting
Pycharm essential plug-in, change the background (self use, continuous update) | CSDN creation punch in
Extended tree (I) - graphic analysis and C language implementation
Right click the idea file to create new. There is no solution to create new servlet
Balanced binary tree [AVL tree] - insert, delete
Navicat connects Oracle
[stm32+esp8266 connect Tencent cloud IOT development platform 2] stm32+esp8266-01s connect Tencent cloud
随机推荐
激光slam学习(2D/3D、偏实践)
Sequence of entity layer, Dao layer, service layer and controller layer
ASP. Net query implementation
C simple question one
aws-aws help报错
[compilation principle] lexical analysis design and Implementation
First week of July
webflux - webclient Connect reset by peer Error
【汇总】看过的一些Panel与视频
平衡二叉树【AVL树】——插入、删除
Lm12 rolling heikin Ashi double K-line filter
SAP HR labor contract information 0016
648. Word replacement
C # exchange number, judge to pass the exam
Installing gradle
Idea automatically generates serialVersionUID
[STM32 + esp-12s connect Tencent cloud IOT development platform 1] creation of cloud platform and burning of at firmware
USB (XVIII) 2022-04-17
【LeetCode】20、有效的括号
One of the anti climbing methods