Skip to content

Instantly share code, notes, and snippets.

View KhaledElshamy's full-sized avatar

Khaled Elshamy KhaledElshamy

View GitHub Profile
@KhaledElshamy
KhaledElshamy / B. Olympic Medal-Codeforces
Created February 11, 2017 19:28
B. Olympic Medal-Codeforces
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int x=0,y=0,z=5000;
int n,m,k,A,B,Xn,Ym,Zk;
cin>>n;
for(int i=0;i<n;i++)
{
@KhaledElshamy
KhaledElshamy / B. Olympic Medal-Codeforces
Created February 10, 2017 21:11
B. Olympic Medal-Codeforces
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
pair<int,int>a[1000],c[1000];
int p,q,l,r;
bool solve(int shift)
{
int i=1,j=1;
while(i<=p&&j<=q)
{
@KhaledElshamy
KhaledElshamy / B. Dreamoon and WiFi-Codeforces
Created February 7, 2017 16:55
B. Dreamoon and WiFi-Codeforces
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s1,s2;
cin>>s1>>s2;
int count=0,count1=0,count2=0,count3,count5,count6=0;
for(int i=0;i<s1.size();i++)
{
@KhaledElshamy
KhaledElshamy / B. Students and Shoelaces-Codeforces
Created February 6, 2017 17:16
B. Students and Shoelaces-Codeforces
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m,x,y,a[101]={0},b[101][101]={0},count1,c[101]={0},count2=0;
cin>>n>>m;
while(m--)
{
cin>>x>>y;
@KhaledElshamy
KhaledElshamy / B. Luxurious Houses-Codeforces
Created February 4, 2017 17:42
B. Luxurious Houses-Codeforces
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int num;
cin>>num;
int a[num],b[num];
for(int i=0;i<num;i++)
cin>>a[i];
@KhaledElshamy
KhaledElshamy / B. President's Office-Codeforces
Created February 3, 2017 21:55
B. President's Office-Codeforces
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m,check[27]={0},res=0;
char c,a[150][150];
cin>>n>>m>>c;
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
@KhaledElshamy
KhaledElshamy / B. Beautiful Paintings-codeforces
Created January 22, 2017 19:16
B. Beautiful Paintings-codeforces
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,a[1001]={0},x,res=0;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>x;
if(res<++a[x])res=a[x];
}
@KhaledElshamy
KhaledElshamy / B. Ilya and Queries-codeforces
Created January 22, 2017 00:47
B. Ilya and Queries-codeforces
#include <bits/stdc++.h>
using namespace std;
int main() {
//Dynamic programming
int num, x,y,d[100000]={0};
vector<int>m;
string s;
cin>>s>>num;
for(int i=s.size()-2;i>=0;i--)
{
@KhaledElshamy
KhaledElshamy / B. Megacity-codeforces
Created January 21, 2017 00:41
B. Megacity-codeforces
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;long s;
cin>>n>>s;
long population=s;
vector< vector< long > >location(n,vector<long>(2));
for(int i=0;i<n;i++)
{
@KhaledElshamy
KhaledElshamy / B. Interesting drink-codeforces
Created January 20, 2017 19:48
B. Interesting drink-codeforces
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,q;
cin>>n;
vector<int>x(n);
for(int i=0;i<n;i++)
cin>>x[i];
sort(x.begin(),x.end());