当前位置:网站首页>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;
}
边栏推荐
- 2022 certified surveyors are still at a loss when preparing for the exam? Teach you how to take the exam hand in hand?
- Dependency injection
- 网上买基金安全么?
- B_QuRT_User_Guide(36)
- [compilation principle] lexical analysis design and Implementation
- ping报错:未知的名称或服务
- ASP. Net core middleware request processing pipeline
- The efficient s2b2c e-commerce system helps electronic material enterprises improve their adaptability in this way
- 解析token的网址
- 【7.4】25. Turn over the linked list in groups of K
猜你喜欢
C number of words, plus ¥, longest word, average value
Idea automatically generates serialVersionUID
Take you hand in hand to build feign with idea
B / Qurt Utilisateur Guide (36)
B_QuRT_User_Guide(36)
B_ QuRT_ User_ Guide(36)
【LeetCode】20、有效的括号
SAP HR family member information
Installing gradle
What if once again forgets the login password of raspberry pie? And you don't have a monitor yet! Today, I would like to introduce a method
随机推荐
B_QuRT_User_Guide(36)
Open source hardware small project: anxinco esp-c3f control ws2812
Anxinco esp32-a1s development board is adapted to Baidu dueros routine to realize online voice function
二叉排序树【BST】——创建、查找、删除、输出
Dependency injection 2 advantage lifecycle
【7.4】25. Turn over the linked list in groups of K
Summary of SQL single table query 2020.7.27
Flash encryption process and implementation of esp32
Class C design questions
gorm 关联关系小结
USB (XVIII) 2022-04-17
SLAM面试总结
Where are you going
Take you hand in hand to build feign with idea
USB (XVI) 2022-04-28
May day C - most
Ora-02437 failed to verify the primary key violation
C number of words, plus ¥, longest word, average value
Have all the fresh students of 2022 found jobs? Is it OK to be we media?
Display the server hard disk image to the browser through Servlet