cf763b.timofeyandrectangles

ws_ccd ws_ccd     2022-08-21     328

关键词:

%%题解,脑洞好大啊。

四色定理什么鬼的。。所以一定是yes。

因为矩形边长都是奇数,所以可以按左下角分类,一共4类,分别1,2,3,4就可以了。

(需要4种颜色的情况大概就是4个矩形围起来一个矩形)

 1 #include<bits/stdc++.h> 
 2 #define LL long long 
 3 #define N 100005
 4 #define lowbit(x) x&(-x)
 5 using namespace std;
 6 inline int ra()
 7 {
 8     int x=0,f=1; char ch=getchar();
 9     while (ch<0 || ch>9) {if (ch==-) f=-1; ch=getchar();}
10     while (ch>=0 && ch<=9) {x=x*10+ch-0; ch=getchar();}
11     return x*f;
12 }
13 int main()
14 {
15     cout<<"YES"<<endl;
16     int n=ra();
17     for (int i=1; i<=n; i++)
18     {
19         int x1=abs(ra()),y1=abs(ra()),x2=ra(),y2=ra();
20         if (x1%2 && y1%2) cout<<"1"<<endl;
21         if (x1%2 && y1%2==0) cout<<"2"<<endl;
22         if (x1%2==0 && y1%2) cout<<"3"<<endl;
23         if (x1%2==0 && y1%2==0) cout<<"4"<<endl;
24     }
25     return 0;
26 } 

 

codeforces763b

解题报告:  直接截图好了...辣鸡博客园不能上传文件  查看详情

763.partitionlabels分区标签

Astring S oflowercaselettersisgiven.Wewanttopartitionthisstringintoasmanypartsaspossiblesothateachletterappearsinatmostonepart,andreturnalistofintegersrepresentingthesizeoftheseparts.Example 查看详情

763.partitionlabels(代码片段)

题目描述:Astring S oflowercaselettersisgiven.Wewanttopartitionthisstringintoasmanypartsaspossiblesothateachletterappearsinatmostonepart,andreturnalistofintegersrepresentingthesizeoftheseparts.&n 查看详情

763.partitionlabels(贪心)(代码片段)

AstringSoflowercaselettersisgiven.Wewanttopartitionthisstringintoasmanypartsaspossiblesothateachletterappearsinatmostonepart,andreturnalistofintegersrepresentingthesizeoftheseparts.Example1:Input:S="a 查看详情

c_cpp763.cpp(代码片段)

查看详情

763.划分字母区间(代码片段)

 方法一:滑动窗口classSolutionpublicList<Integer>partitionLabels(Strings)List<Integer>res=newArrayList<>();int[]arr=newint[128];for(charc:s.toCharArray())arr[c]++;int[]window=newint 查看详情

*leetcode763.partitionlabels(代码片段)

https://leetcode.com/problems/partition-labels/description/constintSIZE=256;classSolutionpublic:booljudge(intcnt[],inthash[])//boolret=true;for(inti=0;i<SIZE;i++)if(hash[i]= 查看详情

codeforces763a.timofeyandatree(dfs)(代码片段)

DescriptionEachNewYearTimofeyandhisfriendscutdownatreeofnverticesandbringithome.Afterthattheypaintallthenitsvertices,sothatthei-thvertexgetscolorci.Nowit’stimeforTimofeybirthday,andhismotheraskedhimto 查看详情

763.划分字母区间(代码片段)

字符串S由小写字母组成。我们要把这个字符串划分为尽可能多的片段,同一个字母只会出现在其中的一个片段。返回一个表示每个字符串片段的长度的列表。 示例1:输入:S="ababcbacadefegdehijhklij"输出:[9,7,8]解释:划分结果... 查看详情

763.partitionlabels(代码片段)

Astring S oflowercaselettersisgiven.Wewanttopartitionthisstringintoasmanypartsaspossiblesothateachletterappearsinatmostonepart,andreturnalistofintegersrepresentingthesizeoftheseparts. Example1:Input:S="ababcbacadefegdehijhklij"Output:[9,7,8]Explanation:Thepartitionis"ababcbaca","defeg... 查看详情

codeforces763a.timofeyandatree

A.Timofeyandatree题意:给一棵树,要求判断是否存在一个点,删除这个点后,所有连通块内颜色一样。$N,Cle10^5$想法:这个叫换根吧。先求出一个点合法即其儿子的子树内颜色一样,非该点子树的点颜色都一样。可以用DFS序解决。&n... 查看详情

763.划分字母区间(代码片段)

目录1、Question2、Analysis3、Code4、Result1、Question        字符串S由小写字母组成。我们要把这个字符串划分为尽可能多的片段,同一字母最多出现在一个片段中。返回一个表示每个字符串片段的长度的列表。示例:输入... 查看详情

[m贪心]lc763.划分字母区间(贪心+代码实现)(代码片段)

文章目录1.题目来源2.题目解析1.题目来源链接:763.划分字母区间2.题目解析lc讨论中看见的华为od面试编程题目,可以试试。贪心思路:本次分割字符串如果在后面都不出现,则单独成一段,作为有效答案。因... 查看详情

codeforcesround#763(div.2)d(推式子+概率)

题目大意:给n*m的矩阵,给机器人起点和垃圾的终点,一开始向右下移动,撞到边界时会反方向移动,当机器人与垃圾同行或者同列时有p/100的概率清理垃圾,求机器人清理掉垃圾的步数期望思路:法... 查看详情

codeforcesround#763(div.2)editorialc解题报告(代码片段)

链接:https://codeforces.com/contest/1623/problem/C题解:二分答案即可。比较困扰我的是两个问题:1.怎么求出ddd。2.如何判断这个midmidmid的值是否合法。会不会出现,满足check,但是实际上不存在midmidmid的情况。第一个:intd&... 查看详情

力扣算法jslc[435.无重叠区间]lc[763.划分字母区间]

菜鸡刷算法的一天,每天分享两题算法,大家有这个想法的,可以给我个关注,然后一起坚持每天的算法之旅。希望我们共同进步,一起加油。菜鸡刷算法的一天,每天分享两题算法,大家有这个想法的,可以给我个关注,然后... 查看详情

菜鸟级彩友机选揽大奖旺站中大乐透763万

...票大乐透第16098期开奖,吉林长春一彩民喜获一等奖,将763万元奖金纳入囊中。 中得大奖的地址为:长春市西城家园16栋109号门市第02230代销点,当业主庞先生得知本站中了一个一等奖,特别兴奋,随即制作了大喜报及多条条... 查看详情

leetcode763.partitionlabels划分字母区间(中等)

一个字符串S,将其尽可能多的分割为子字符串,条件是每种字符最多只能出现在一个子串中。上面的示例中,字符串S中有多个a,这些a必须只能在第一个子串中,字母e出现在第二个子串中。这道题难点就是如何找到字符串的断... 查看详情