Skip to content

Commit 42bcc80

Browse files
committed
# Problem 2
1 parent ece5f55 commit 42bcc80

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed

CP/ Code Conquest/prob1.py

Whitespace-only changes.

CP/ Keteki Quick Match 6.5/prob1.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
for __ in range(int(input())):
2+
k = int(raw_input())
3+
p = list()
4+
ne= list()
5+
n1 = list()
6+
for j in range(k):
7+
n1 = raw_input().split()
8+
s1 = raw_input()
9+
if s1=="yes":
10+
p.extend(n1)
11+
else:
12+
ne.extend(n1)
13+
# print(p)
14+
# print(ne)
15+
#
16+
# print(set(p))
17+
# print(set(ne))
18+
# print(set(p)-set(ne))
19+
20+
print(len(set(p)-set(ne)))
21+
# print(p)
22+
# print(ne)

CP/ Keteki Quick Match 6.5/prob2.cpp

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long int
3+
#define pb push_back
4+
#define ppb pop_back
5+
#define mp make_pair
6+
#define pii pair<int,int>
7+
#define vll vector<ll>
8+
#define vi vector<int>
9+
#define d0(x) cout<<x<<" "
10+
#define d1(x) cout<<x<<"\n"
11+
#define d2(x,y) cout<<x<<" "<<y<<"\n"
12+
#define d3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
13+
#define d4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<"\n"
14+
using namespace std;
15+
const ll mod=1e9+7;
16+
17+
int main()
18+
{
19+
//freopen("input.txt","r",stdin);
20+
ios_base::sync_with_stdio ( false );
21+
int t;cin>>t;
22+
while(t--)
23+
{
24+
int g,b;cin>>g>>b;
25+
string s[g][b];int score[g][b];
26+
for(int i=0;i<g;i++)
27+
{
28+
for(int j=0;j<b;j++)
29+
{
30+
string k;
31+
cin>>s[i][j]>>k>>score[i][j];
32+
}
33+
}
34+
string t1,t2;cin>>t1>>t2;
35+
int a1,b1,a2,b2;
36+
for(int i=0;i<g;i++)
37+
{
38+
for(int j=0;j<b;j++)
39+
{
40+
if(t1==s[i][j]){a1=i;b1=j;}
41+
if(t2==s[i][j]){a2=i;b2=j;}
42+
}
43+
}
44+
swap(s[a1][b1],s[a2][b2]);
45+
swap(score[a1][b1],score[a2][b2]);
46+
for(int i=0;i<g;i++)
47+
{
48+
for(int j=0;j<b;j++)
49+
{
50+
for(int k=0;k<b-1;k++)
51+
{
52+
if(score[i][k]<score[i][k+1])
53+
{
54+
swap(score[i][k],score[i][k+1]);
55+
swap(s[i][k],s[i][k+1]);
56+
}
57+
}
58+
}
59+
}
60+
for(int i=0;i<g;i++)
61+
{
62+
cout<<s[i][0]<<"\n";
63+
}
64+
}
65+
}

0 commit comments

Comments
 (0)