codeforces Intel Code Challenge Final Round (div.1 + div.2 combined)
2016-10-09 23:15
441 查看
比赛水掉3题rk559 rating+115
赛后切掉C
n年没打cf了终于又重新变蓝了,果然太弱。。。
1.A题 Checking the Calendar
给定两个星期几,问是否可能分别是两个月的第一天。
水题暴力枚举月份
View Code
赛后切掉C
n年没打cf了终于又重新变蓝了,果然太弱。。。
1.A题 Checking the Calendar
给定两个星期几,问是否可能分别是两个月的第一天。
水题暴力枚举月份
#include<cstdio> #include<cstring> #include<cstdlib> #include<vector> #include<algorithm> #include<functional> #include<iostream> #include<cmath> #include<string> #include<cctype> #include<stack> #include<queue> #include<set> #include<sstream> #include<map> using namespace std; #define FORD(i,k,n) for(int i=n;i>=k;i--) #define FOR(i,k,n) for(int i=k;i<=n;i++) #define CLR(a,b) memset(a,b,sizeof(a)); #define INF 0x3f3f3f3f #define LLINF 0x3f3f3f3f3f3f3f3f #define ll long long #define LL long long #define ull unsigned long long #define i64 long long #define u32 unsigned int #define u64 unsigned long long #define ptb(b,a){int tmp=a;string s;do{s+=tmp%2+'0';tmp/=2;}while(tmp);reverse(s.begin(),s.end());cout<<"bin "<<b<<"="<<s<<endl;} #define pta(i,a,f,b) {FOR(i,f,b) cout<<a[i]<<" "; printf("\n");} #define pt(a,b) cout<<a<<"="<<b<<endl #define pt1(a) cout<<a<<endl #define pt2(a,b) cout<<a<<" "<<b<<endl #define pt3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl #define pt4(a,b,c,d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl #define ptl1 cout<<"-------------"<<endl #define ptl2 cout<<"~~~~~~~~~~~~~~~~"<<endl #define fp freopen("in.txt","r",stdin) #define maxn 200000 int T,N,m,flg; string ans; char s[maxn]; int last; int vis[maxn]; void read() { scanf("%d %s",&m,s+1); } void preprocess() { } void solve() { int len=strlen(s+1); FOR(i,'a','z') { last=0; int l=1,r=m; FOR(k,1,m) { if((last==0&&s[k]==i)||(s[k]<=s[last])||vis[k]) last=k; } string tmp; if(last&&s[last]==i) tmp+=i; // pt1(last); while(r<len&&last) { l++; r++; if(last>=l&&last<=r) continue; else { last=0; FOR(k,l,r) { if((last==0&&s[k]==i)||(s[k]<=s[last])||vis[k]) last=k; } if(last&&s[last]==i) { tmp+=i; } } // pt4(last,l,r,ans); } if(last) { ans+=tmp; break; } else { FOR(k,1,len) { if(s[k]==i) { vis[k]=1; ans+=i; } } } } cout<<ans<<endl; } int main() { { read(); solve(); } return 0; }
View Code
相关文章推荐
- Coderforces Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined)
- Codeforces Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined)
- codeforces Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) 题解(A-D)
- Codeforces Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) 部分题解
- Codeforces Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined)
- DP+最小割——Intel Code Challenge Final Round (div.1 + div.2 combined) E
- Intel Code Challenge Elimination Round (Div.1 + Div.2, combined)(set容器里count函数以及加强for循环)
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) D题
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) B. Batch Sort 暴力
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) C. Ray Tracing
- 【Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) E】 【动态规划+网络流的思想】 Goods transportation
- Intel Code Challenge Elimination Round (Div.1 + Div.2, combined)C. Destroying Array(想法题/并查集)
- Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) D. Generating Sets 贪心+优先队列
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) C. Ray Tracing
- Codeforces Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) B. Batch Sort(暴力)
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) A题
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined)A. Checking the Calendar
- Codeforces Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) A. Checking the Calendar(水题)
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) C. Ray Tracing 数学
- Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) C. Destroying Array -- 逆向思维