日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

CODE FESTIVAL 2017 qual B

發布時間:2025/7/14 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CODE FESTIVAL 2017 qual B 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

昨晚因為有點事就去忙了,沒打后悔啊

A - XXFESTIVAL


Time limit?: 2sec /?Memory limit?: 256MB

Score :?100?points

Problem Statement

Rng is going to a festival.

The name of the festival is given to you as a string?S, which ends with?FESTIVAL, from input. Answer the question: "Rng is going to a festival of what?" Output the answer.

Here, assume that the name of "a festival of?s" is a string obtained by appending?FESTIVAL?to the end of?s. For example,?CODEFESTIVAL?is a festival of?CODE.

Constraints

  • 9≤|S|≤50
  • S?consists of uppercase English letters.
  • S?ends with?FESTIVAL.

Input

Input is given from Standard Input in the following format:

S

Output

Print the answer to the question: "Rng is going to a festival of what?"


Sample Input 1

Copy CODEFESTIVAL

Sample Output 1

Copy CODE

This is the same as the example in the statement.


Sample Input 2

Copy CODEFESTIVALFESTIVAL

Sample Output 2

Copy CODEFESTIVAL

This string is obtained by appending?FESTIVAL?to the end of?CODEFESTIVAL, so it is a festival of?CODEFESTIVAL.


Sample Input 3

Copy YAKINIKUFESTIVAL

Sample Output 3

Copy YAKINIKU

?

#include<bits/stdc++.h> using namespace std; int main() {string s;cin>>s;int l=s.length()-8;for(int i=0; i<l; ++i)putchar(s[i]);return 0; }

?

B - Problem Set


Time limit?: 2sec /?Memory limit?: 256MB

Score :?200?points

Problem Statement

Rng is preparing a problem set for a qualification round of CODEFESTIVAL.

He has?N?candidates of problems. The difficulty of the?i-th candidate is?Di.

There must be?M?problems in the problem set, and the difficulty of the?i-th problem must be?Ti. Here, one candidate of a problem cannot be used as multiple problems.

Determine whether Rng can complete the problem set without creating new candidates of problems.

Constraints

  • 1≤N≤200,000
  • 1≤Di≤109
  • 1≤M≤200,000
  • 1≤Ti≤109
  • All numbers in the input are integers.

Partial Score

  • 100?points will be awarded for passing the test set satisfying?N≤100?and?M≤100.

Input

Input is given from Standard Input in the following format:

N D1 D2 … DN M T1 T2 … TM

Output

Print?YES?if Rng can complete the problem set without creating new candidates of problems; print?NO?if he cannot.


Sample Input 1

Copy 5 3 1 4 1 5 3 5 4 3

Sample Output 1

Copy YES

Sample Input 2

Copy 7 100 200 500 700 1200 1600 2000 6 100 200 500 700 1600 1600

Sample Output 2

Copy NO

Not enough?1600s.


Sample Input 3

Copy 1 800 5 100 100 100 100 100

Sample Output 3

Copy NO

Sample Input 4

Copy 15 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 9 5 4 3 2 1 2 3 4 5

Sample Output 4

Copy YES

用map看一下數據是否合法就行了

#include<bits/stdc++.h> using namespace std; map<int,int>M; int main() {int n,m;cin>>n;for(int i=0; i<n; i++){int x;cin>>x,M[x]++;}cin>>m;int f=0;for(int i=0; i<m; i++){int x;cin>>x;if(!M[x]){f=1;break;}else M[x]--;}cout<<(f?"NO\n":"YES\n");return 0; }

?

C - 3 Steps


Time limit?: 2sec /?Memory limit?: 256MB

Score :?500?points

Problem Statement

Rng has a connected undirected graph with?N?vertices. Currently, there are?M?edges in the graph, and the?i-th edge connects Vertices?Ai?and?Bi.

Rng will add new edges to the graph by repeating the following operation:

  • Operation: Choose?u?and?v?(u≠v)?such that Vertex?v?can be reached by traversing exactly three edges from Vertex?u, and add an edge connecting Vertices?uand?v. It is not allowed to add an edge if there is already an edge connecting Vertices?u?and?v.

Find the maximum possible number of edges that can be added.

Constraints

  • 2≤N≤105
  • 1≤M≤105
  • 1≤Ai,Bi≤N
  • The graph has no self-loops or multiple edges.
  • The graph is connected.

Input

Input is given from Standard Input in the following format:

N M A1 B1 A2 B2 : AM BM

Output

Find the maximum possible number of edges that can be added.


Sample Input 1

Copy 6 5 1 2 2 3 3 4 4 5 5 6

Sample Output 1

Copy 4

If we add edges as shown below, four edges can be added, and no more.


Sample Input 2

Copy 5 5 1 2 2 3 3 1 5 4 5 1

Sample Output 2

Copy 5

Five edges can be added, for example, as follows:

  • Add an edge connecting Vertex?5?and Vertex?3.
  • Add an edge connecting Vertex?5?and Vertex?2.
  • Add an edge connecting Vertex?4?and Vertex?1.
  • Add an edge connecting Vertex?4?and Vertex?2.
  • Add an edge connecting Vertex?4?and Vertex?3.

搞成二分圖然后dfs啊

然后再利用六哥的兩邊的個數想乘就好了

#include<bits/stdc++.h> using namespace std; const int N=1e5+5; bool f=0; int c[N],cnt[3]; vector<int>G[N]; void dfs(int x,int ff=1) {if(c[x]){f|=ff!=c[x];return;}c[x]=ff;cnt[ff]++;for(int u:G[x])dfs(u,3-ff); } int main() {int n,m;scanf("%d%d",&n,&m);for(int i=0; i<m; ++i){int u,v;scanf("%d%d",&u,&v);G[u].push_back(v);G[v].push_back(u);}dfs(1);printf("%lld\n",f?1LL*n*(n-1)/2-m:1LL*cnt[1]*cnt[2]-m);return 0; }

?

轉載于:https://www.cnblogs.com/BobHuang/p/7639623.html

總結

以上是生活随笔為你收集整理的CODE FESTIVAL 2017 qual B的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 亚洲天堂网在线视频 | www精品视频| 中文字幕乱码在线人视频 | 国产成人精品一区二三区四区五区 | 免费性情网站 | 激情综合站 | 一区二区不卡av | av毛片网 | 亚洲午夜免费 | 在线观看国产欧美 | 香蕉av在线 | 亚洲欧美国产精品 | 国产精品99精品无码视亚 | 亚洲熟妇国产熟妇肥婆 | 欧美午夜精品一区二区三区电影 | 日韩福利一区 | 久久精品3 | 大奶子情人 | 黄色网页在线免费观看 | 青娱乐国产盛宴 | 四虎永久网址 | 日本在线播放一区 | 日本福利一区二区 | 成人h视频 | 日韩三级av在线 | 在线观看色 | 日韩狠狠操 | 黄色中文字幕 | 亚洲精品www久久久久久 | 激情小说亚洲图片 | 日本丰满少妇一区二区三区 | 亚洲黄业 | 奶水旺盛的少妇在线播放 | 国产特黄毛片 | 精产国产伦理一二三区 | 黑人操日本女优 | 欧美一区二区区 | 麻豆剧场 | 国产成人在线视频免费观看 | 北岛玲av在线 | 国产美女毛片 | 亚洲精品国产精品乱码不99按摩 | av福利影院 | 午夜小视频在线观看 | 色综合啪啪 | 久久午夜视频 | 波多野结衣中文在线 | 欧美多人猛交狂配 | 九九九九久久久久 | 日本韩国中文字幕 | 美女扒开大腿让男人桶 | 亚洲精品永久免费 | 国产精品久久久久久无人区 | 女人囗交吞精囗述 | 久久噜噜色综合一区二区 | 怡红院一区二区三区 | 色老汉视频 | 国产xxxx孕妇 | 特级性生活片 | 日本成人免费视频 | 亚洲精品免费av | 最近最好的2019中文 | 97香蕉久久超级碰碰高清版 | 九七精品 | 国产对白videos麻豆高潮 | 日本免费一区二区三区四区 | 一本色道久久hezyo加勒比 | 国产三级日本三级在线播放 | 日韩伦理一区二区 | 在线观看av中文字幕 | 理论片午午伦夜理片影院99 | 亚洲国内精品 | 天堂网中文 | 亚洲久久天堂 | 中文字幕+乱码+中文字幕明步 | 成人激情小说网站 | 亚洲AV无码精品国产 | 久久久久无码国产精品一区 | 国产精品毛片一区二区在线看 | 97精品熟女少妇一区二区三区 | 久久久久久免费毛片精品 | 成人涩涩网站 | 国产日日夜夜 | 黄片一区二区 | 欧美成人视屏 | 性色免费视频 | 波多野结衣av在线观看 | 国产自产精品 | av片免费观看 | 国产三级a | 久久国产黄色片 | 免费成人福利视频 | 轻点好疼好大好爽视频 | 激情视频久久 | 91一区视频| 欧美大白屁股 | 亚洲天堂男| 天堂男人av | 国产传媒一区二区 |