当前位置:网站首页>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;
}
边栏推荐
- JNI uses asan to check memory leaks
- C语言学习
- First week of July
- B / Qurt Utilisateur Guide (36)
- As a new force, chenglian premium products was initially injected, and the shares of relevant listed companies rose 150% in response
- The file format and extension of XLS do not match
- Have all the fresh students of 2022 found jobs? Is it OK to be we media?
- Extended tree (I) - graphic analysis and C language implementation
- SAP HR labor contract information 0016
- archery安装测试
猜你喜欢
【实验分享】通过Console口登录到Cisco设备
Ora-01741 and ora-01704
Open source hardware small project: anxinco esp-c3f control ws2812
SAP HR social work experience 0023
B_QuRT_User_Guide(38)
Flash encryption process and implementation of esp32
【LeetCode】20、有效的括号
USB (XV) 2022-04-14
New potential energy of industrial integration, Xiamen station of city chain technology digital summit successfully held
关于CH32库函数与STM32库函数的区别
随机推荐
Summary of common methods of object class (September 14, 2020)
Interface
Balanced binary tree [AVL tree] - insert, delete
[stm32+esp8266 connects to Tencent cloud IOT development platform 3] stm32+esp8266-01s dynamically registers devices on Tencent cloud (at instruction mode) -- with source code
【LeetCode】20、有效的括号
SAP HR 劳动合同信息 0016
Dataguard 主备清理归档设置
Given an array, such as [7864, 284, 347, 7732, 8498], now you need to splice the numbers in the array to return the "largest possible number."
S2b2b mall solution of intelligent supply chain in packaging industry: opening up a new ecosystem of e-commerce consumption
进度播报|广州地铁七号线全线29台盾构机全部完成始发
【7.5】15. Sum of three numbers
激光slam学习(2D/3D、偏实践)
0-1背包问题
Display the server hard disk image to the browser through Servlet
SAP HR 家庭成员信息
Reverse output three digit and arithmetic sequence
C number of words, plus ¥, longest word, average value
redis缓存工具类,值得拥有~
B_QuRT_User_Guide(39)
C inheritance and interface design polymorphism