The Preliminary Contest for ICPC Asia Xuzhou 2019(补题)

E.XKC's basketball team

ps:

比赛过程中读错题了,而且一直没发现(好难受)。以为要求满足要求的个数,一直没有思路,没想到是求最长距离,那就很容易了。

solution:

贪心的从后往前维护一个单调递增序列,因为对于i<j,a[i]<=a[j],对于i之前的数那么a[j]可以完全替代a[i]的作用。

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 const int maxn=5e5+5;
 4 typedef long long ll;
 5 
 6 inline int read()
 7 {
 8     char ch=getchar();int x=0,f=0;
 9     while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
10     while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
11     return f?-x:x;
12 }
13 
14 
15 int a[maxn];
16 int num[maxn];
17 vector <int > V;
18 int main(){
19     int n,m;n=read();m=read();
20     for(int i=1;i<=n;i++) a[i]=read();
21     V.push_back(n);num[n]=-1;
22     for(int i=n-1;i>=1;i--){
23         int tmp=a[i]+m;
24         int l=0;int r=V.size()-1;
25         int ans=-1;
26         while(l<=r){
27             int mid=(l+r)/2;
28             if(a[V[mid]]>=tmp) 
29             {
30                 ans=max(ans,V[mid]); 
31                 r=mid-1;
32             }
33             else{
34                 l=mid+1;
35             } 
36         }
37         if(ans==-1) num[i]=ans;
38             else num[i]=ans-i-1;
39         if(a[i]>a[V[V.size()-1]]) V.push_back(i);
40         
41     }
42     for(int i=1;i<=n;i++){
43         if(i==1) cout <<num[i];
44         else cout <<" "<<num[i];
45     }    
46     return 0;
47 }

 K.Center

solution:

暴力枚举每两个点的中点,然后找到出现次数最多的中点,ans=n-tans,因为tans是n^2枚举的,所以不用*2.

有一个疑问,为什么加了if(i==j) continue;之后会re。(真的好神奇)

 

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 const int maxn=5e5+5;
 4 typedef long long ll;
 5 
 6 struct node{
 7     int x;int y;
 8 }e[10005];
 9 map<pair<int,int>,int>M;
10 int main(){
11     std::ios::sync_with_stdio(false);
12     int n;cin>>n;
13     for(int i=1;i<=n;i++) cin>>e[i].x>>e[i].y,e[i].x*=2,e[i].y*=2;
14     int tans=0;
15     for(int i=1;i<=n;i++){
16         for(int j=1;j<=n;j++){18                 int tmx=(e[i].x+e[j].x)/2;
19                 int tmy=(e[i].y+e[j].y)/2;
20                 pair <int,int > P;
21                 P=make_pair(tmx,tmy);
22                 M[P]++;
23                 if(M[P]>tans) tans=M[P];25 
26         }
27     }
28     cout <<n-tans<<"\n";
29     
30     
31     return 0;
32 }

 

转载于:https://www.cnblogs.com/Msmw/p/11482844.html

Sure, I'd be happy to give you some ideas for organizing a speech contest. Here are some suggestions: 1. Determine the theme and rules: Decide on the theme of the contest and the rules for participants. Will it be an open topic, or will there be a specific theme? What is the maximum length of the speech? Will there be any specific guidelines for language or content? 2. Decide on the judging criteria: Determine how the speeches will be evaluated. Will judges be looking for content, delivery, or both? Will there be a score sheet or rubric that judges will use to score the speeches? 3. Recruit judges: Find people who are qualified to judge the speeches. Ideally, they should have experience in public speaking or have a background in the theme of the contest. 4. Promote the contest: Advertise the contest to potential participants, such as students, professionals, or members of a specific community. Use social media, flyers, and other methods to get the word out. 5. Registration and selection: Set a deadline for registration and selection of participants. Consider having a preliminary round to narrow down the field before the final competition. 6. Prepare the venue: Ensure that the venue is suitable for the contest. Make sure that there is adequate seating, sound equipment, and lighting for the speakers. 7. Hold the contest: Set a date and time for the contest, and make sure that all participants and judges are aware of the schedule. Encourage audience participation and provide refreshments. 8. Award ceremony: After the contest, hold an award ceremony to recognize the winners and participants. Provide certificates or other prizes to the top performers. I hope these ideas help you in organizing a successful speech contest!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值