Skip to content

Commit bd20834

Browse files
Added codechef question QUIZPLAG
1 parent 5907dc5 commit bd20834

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

Codechef solutions/QUIZPLAG.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// THIS QUESTION IS AVAILABLE ON CODECHEF https://www.codechef.com/problems/QUIZPLAG
2+
#include <iostream>
3+
#include<vector>
4+
#include<cstring>
5+
using namespace std;
6+
void solve()
7+
{
8+
int n,m,k,id;
9+
cin>>n>>m>>k;
10+
int L[n+m+1];
11+
memset(L,0,sizeof(L));
12+
for(int i=1;i<=k;i++)
13+
{
14+
cin>>id;
15+
L[id]++;
16+
}
17+
vector<int>ans;
18+
for(int i=1;i<=n;i++)
19+
{
20+
if(L[i]>1)
21+
{
22+
ans.push_back(i);
23+
}
24+
}
25+
int size=ans.size();
26+
cout<<size;
27+
for(int i=0;i<size;i++)
28+
{
29+
cout<<" "<<ans[i];
30+
}
31+
cout<<endl;
32+
33+
}
34+
35+
int main() {
36+
int t;
37+
cin>>t;
38+
while(t--)
39+
{
40+
solve();
41+
}
42+
return 0;
43+
}

0 commit comments

Comments
 (0)