Monthly Archives: December 2016

Timus Solutions

Here it goes 1510 : Order

Rate this:

Posted in timus, Uncategorized | Tagged | Leave a comment

1510 : Order

Problem Link Huge chance to get TLE on 21 & 31 , i got 5times 😥 Morning shock #Solution #include <iostream> #include <string> #include <vector> #include <set> #include <queue> #include <map> #include <stack> #include <algorithm> #include <cstring> #include <cmath> #include … Continue reading

Rate this:

Posted in timus, Uncategorized | Tagged , , | Leave a comment

11244 – Counting Stars

Problem Link #Solution #include<cstdio> using namespace std; int dx[]={-1,1,0,0,-1,1,-1,1}; int dy[]={0,-1,1,-1,-1,1,1,0}; int main() { int n,m,c,tx,ty,res; while(scanf(“%d %d”,&n,&m)==2 && n &&m) { int i,j,k; res=0; char vis[105][105]={0}; for(i=0;i<n;i++) scanf(“%s”,vis[i]); for(i=0;i<n;i++) { for(j=0;j<m;j++) {c=1; if(vis[i][j]==’*’) { for(c=0,k=0;k<8;k++) { tx=i+dx[k]; ty=j+dy[k]; if(tx>=0 … Continue reading

Rate this:

Posted in Uncategorized, uva | Tagged , , | Leave a comment

752B. Santa Claus and Keyboard Check

  Problem Link #Solution   #include<bits/stdc++.h> using namespace std; #define F first #define S second #define mp make_pair vector<pair<char,char>>res; #define pb push_back map<char,int>chk; int main() { string a,b; cin>>a>>b; if(a==b) {cout<<0<<endl; return 0; } for(int i=0;i<a.size();i++) { if(a[i]!=b[i]) { res.pb(mp(a[i],b[i])); … Continue reading

Rate this:

Posted in Codeforces, Uncategorized | Tagged , | Leave a comment

Coinage

Problem Link   #Solution – Idea :Editorial   #include <bits/stdc++.h> using namespace std; int f[1005]; int main(void) { int t; cin >> t; while (t–) { int a, b, c, d, A, B, C, D, N; long long ans = … Continue reading

Rate this:

Posted in Uncategorized | Tagged , , | Leave a comment

10653 – Bombs! NO they are Mines!!

Problem Link #Solution #include<bits/stdc++.h> using namespace std; int r,c; #define cln(a) memset(a,0,sizeof a) int dx[]={+1,-1,0,0}; int dy[]={0,0,-1,+1}; #define uu first #define vv second #define pii pair<int,int> #define sz 10000 int vis[sz][sz],cost[sz][sz],d[sz][sz]; queue<pii>q; void bfs(int a,int b) { int vx,vy; vis[a][b]=1; … Continue reading

Rate this:

Posted in Uncategorized, uva | Tagged , , , | Leave a comment

784 – Maze Exploration

Problem Link #Solution #include #include using namespace std; char in[100][100]; void dfs(int a,int b) { if(in[a][b]==’X’ || in[a][b]==’#’) return ; in[a][b]=’#’; dfs(a+1,b); dfs(a-1,b); dfs(a,b+1); dfs(a,b-1); } int main() { int t,n,i,j; scanf(“%d “,&t); while(t–) { n=0; while(gets(in[n])) { if(in[n][0]==’_’) break; … Continue reading

Rate this:

Posted in Uncategorized, uva | Tagged , , , | Leave a comment