/// Raihan Ruhin /// CSE, Jahangirnagar University. /// Dhaka-Bangladesh. /// id: raihanruhin (topcoder / codeforces / codechef / uva / uvalive / spoj), 3235 (lightoj) /// mail: raihanruhin@ (yahoo / gmail / facebook) /// blog: ruhinraihan.blogspot.com #include<bits/stdc++.h> using namespace std; #define SET(a) memset(a,-1,sizeof(a)) #define CLR(a) memset(a,0,sizeof(a)) #define PI acos(-1.0) #define MOD 1000000007 #define MX 100000 int main() { ios_base::sync_with_stdio(0);cin.tie(0); int tc, kk=1, nx,ny; double w, x; vector<double> d; while(cin>>nx>>ny>>w && nx) { bool flag=true; d.clear(); d.push_back(-w/2.0); d.push_back(75.0 + w/2.0); for(int i=0;i<nx;i++) { cin>>x; d.push_back(x); } sort(d.begin(), d.end()); for(int i=0;i<=nx;i++) if((d[i+1]-d[i])>w) { //cout<<d[i+1]<< " "<<d[i]<<endl; flag=false; } d.clear(); d.push_back(-w/2.0); d.push_back(100.0 + w/2.0); for(int i=0;i<ny;i++) { cin>>x; d.push_back(x); } sort(d.begin(), d.end()); for(int i=0;i<=ny;i++) if((d[i+1]-d[i])>w) flag=false; if(flag) cout<<"YES\n"; else cout<<"NO\n"; } return 0; }
Sunday, 6 March 2016
Lawn mower (UVALive 4954, UVA 12269, Regionals 2010 >> Europe - Southwestern)
Wednesday, 2 March 2016
Word Index (UVA 417, UVALive 5392, ZOJ 1342, POJ 1496, HDU 1336, SCU 1024)
/// Raihan Ruhin /// CSE, Jahangirnagar University. /// Dhaka-Bangladesh. /// id: raihanruhin (topcoder / codeforces / codechef / uva / uvalive / spoj), 3235 (lightoj) /// mail: raihanruhin@ (yahoo / gmail / facebook) /// blog: ruhinraihan.blogspot.com #include<bits/stdc++.h> using namespace std; #define SET(a) memset(a,-1,sizeof(a)) #define CLR(a) memset(a,0,sizeof(a)) #define PI acos(-1.0) #define MOD 1000000007 #define MX 100000 map<string, int> mp; int cnt; void precal(string s, int len) { if(s.length()==len) { mp[s]=cnt++; return; } //cout<<s<<endl; char lst; if(s.length()==0) lst='a'; else lst = s[s.length()-1]+1; for(char ch=lst;ch<='z';ch++) precal(s+ch, len); return; } int main() { ios_base::sync_with_stdio(0);cin.tie(0); int tc, kk=1, n; string s; cnt=1; for(int i=1;i<=5;i++) { precal("", i); // cout<<i<<endl; } while(cin>>s) { cout<<mp[s]<<"\n"; } return 0; }
Subscribe to:
Posts (Atom)