Skip to content

Commit

Permalink
# Problem 2
Browse files Browse the repository at this point in the history
  • Loading branch information
harrypotter0 committed Feb 14, 2018
1 parent ece5f55 commit 42bcc80
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
Empty file added CP/ Code Conquest/prob1.py
Empty file.
22 changes: 22 additions & 0 deletions CP/ Keteki Quick Match 6.5/prob1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
for __ in range(int(input())):
k = int(raw_input())
p = list()
ne= list()
n1 = list()
for j in range(k):
n1 = raw_input().split()
s1 = raw_input()
if s1=="yes":
p.extend(n1)
else:
ne.extend(n1)
# print(p)
# print(ne)
#
# print(set(p))
# print(set(ne))
# print(set(p)-set(ne))

print(len(set(p)-set(ne)))
# print(p)
# print(ne)
65 changes: 65 additions & 0 deletions CP/ Keteki Quick Match 6.5/prob2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define pii pair<int,int>
#define vll vector<ll>
#define vi vector<int>
#define d0(x) cout<<x<<" "
#define d1(x) cout<<x<<"\n"
#define d2(x,y) cout<<x<<" "<<y<<"\n"
#define d3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define d4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<"\n"
using namespace std;
const ll mod=1e9+7;

int main()
{
//freopen("input.txt","r",stdin);
ios_base::sync_with_stdio ( false );
int t;cin>>t;
while(t--)
{
int g,b;cin>>g>>b;
string s[g][b];int score[g][b];
for(int i=0;i<g;i++)
{
for(int j=0;j<b;j++)
{
string k;
cin>>s[i][j]>>k>>score[i][j];
}
}
string t1,t2;cin>>t1>>t2;
int a1,b1,a2,b2;
for(int i=0;i<g;i++)
{
for(int j=0;j<b;j++)
{
if(t1==s[i][j]){a1=i;b1=j;}
if(t2==s[i][j]){a2=i;b2=j;}
}
}
swap(s[a1][b1],s[a2][b2]);
swap(score[a1][b1],score[a2][b2]);
for(int i=0;i<g;i++)
{
for(int j=0;j<b;j++)
{
for(int k=0;k<b-1;k++)
{
if(score[i][k]<score[i][k+1])
{
swap(score[i][k],score[i][k+1]);
swap(s[i][k],s[i][k+1]);
}
}
}
}
for(int i=0;i<g;i++)
{
cout<<s[i][0]<<"\n";
}
}
}

0 comments on commit 42bcc80

Please sign in to comment.