(我的妈,都快倒数了还打个屁啊。不过翻个车能冷静下来,又知道了几个知识盲区,以免省赛出现相同的情况)
I self-criticism three thousand!!!
I self-criticism three thousand!!!
I self-criticism three thousand!!!
翻车总结:
1. 首先就是心态不好,看榜单不断地更新,心里慌慌的,被卡很多人过的一个题真的要炸了。
2. 同时卡三个题,导致最后一个都没出,这是战术问题,不能老切换思路。
3. 做题量真的是太少了,有一些盲区都没接触过,三角面积海伦公式丢的精度不止一点点啊,今天翻车也是有好处的。
4. 心态炸之后不能冷静读题,又眼睁睁看着I过一片,十分痛苦。
5. 总之,菜是原罪,还是多做做题吧。
导致炸心态的根源的死亡B题:
Little Sub has learned a new word ’Triple’, which usually means a group with three elements in it.
Now he comes up with an interesting problem for you.
Define
Given an positive integer sequence A and some queries. In each query, you have to tell if there exists
a triple T = (x, y, z) such that:
1.x, y, z are unique integers.
2.l≤x, y, z≤r.
3.Ax≤Ay≤Az .
4.F(Ax, Ay, Az) > 1.
The first line contains two positive integers n, q(1 ≤ n, q ≤ 200000).
The second line contains n positive integers, indicating the integer sequence.
The next q lines describe each query by giving two integer l, r(1≤l≤r≤n).
All given integers will not exceed 231-1.
题目分析:对于一个区间内如果存在结果那么三个连续的一定是最优结果。但是区间要排序,复杂度不够啊。(就是死活想不到)那么考虑一个集合什么时候不存在解,当然是所有的C【i-1】+C【i-2】<=C【i】,为了使这个区间最长考虑极端的情况如果全部都满足上边的等式,那么一定没有解,所以最极端的斐波那契再加任何一个数一定会出解(就是想不到,就是想不到自我检讨三千遍 I review meself three thousand ),所以区间长度50以上一定会yes,但是50以下要特判,暴力就可以了(难受之根源)。
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll MAXN=1e6+5;
ll C[MAXN];ll now[5500];
int main()
{
ll n,q;
scanf("%lld%lld",&n,&q);
for(ll i=1;i<=n;i++){
scanf("%lld",&C[i]);
}
while(q--)
{
ll l,r;
scanf("%lld%lld",&l,&r);
if(r-l+1>=49){
printf("YES\n");
continue;
}
if(r-l+1<=2){
printf("NO\n");
continue;
}
ll cnt=0;
for(ll i=l;i<=r;i++){
now[++cnt]=C[i];
}
sort(now+1,now+1+cnt);
bool f=0;
for(ll i=3;i<=cnt;i++){
if(now[i-1]+now[i-2]>now[i]){
f=1;break;
}
}
//cout<<f<<endl;
if(f)printf("YES\n");
else printf("NO\n");
}
}
死亡I题:
题目分析:分析个屁,自己没读懂题意 I self-criticism three thousand!!!
observed or deducted 词汇量+=2; I self-criticism three thousand!!!
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e6+6;
char S[MAXN],T[MAXN],vis[500],vis2[505];
int main()
{
scanf("%s%s",S,T);
int len=strlen(S);
map<char,char>mm,mm2;
int cnt=0;
bool f=1;
for(int i=0;i<len;i++){
if(mm[S[i]]==T[i])continue;
if(!vis[S[i]]&&!vis2[T[i]]){
mm[S[i]]=T[i];
vis[S[i]]=1;
vis2[T[i]]=1;
cnt++;
}
else{
f=0;break;
}
}
if(f){
if(cnt==25){
char a,b;
for(int i='a';i<='z';i++){
if(!vis[i])a=char(i);
}
for(int i='a';i<='z';i++){
if(!vis2[i])b=char(i);
}
mm[a]=b;
}
for(int i='a';i<='z';i++){
if(mm[i]){
cout<<char(i)<<"->"<<mm[i]<<endl;
}
}
}
else{
cout<<"Impossible"<<endl;
}
}
死亡K题:
题目分析:海伦公式你真好,好就好在精度丢失,从而降低了计算机内存资源开销,以后再也不用了。
I self-criticism three thousand!!!
I self-criticism three thousand!!!
I self-criticism three thousand!!!
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN=3e6+6;
double area[MAXN];
struct node
{
double x,y;
}C[MAXN];
int main()
{
int n,q;
scanf("%d%d",&n,&q);
for(int i=1;i<=n;i++){
scanf("%lf%lf",&C[i].x,&C[i].y);
}
int cnt=0;
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++){
for(int k=j+1;k<=n;k++){
double xx=C[j].x-C[i].x,yy=C[j].y-C[i].y;
double aa=C[k].x-C[i].x,bb=C[k].y-C[i].y;
double are=abs(xx*bb-yy*aa);
area[++cnt]=are/2.0;
}
}
}
sort(area+1,area+1+cnt);
while(q--)
{
ll l,r;
scanf("%lld%lld",&l,&r);
int ans1=lower_bound(area+1,area+1+cnt,l)-area;
int ans2=upper_bound(area+1,area+1+cnt,r)-area;
printf("%d\n",ans2-ans1);
}
}
这个M题说不上死亡,毕竟SG就触及到我的知识盲区了,毕竟题目里边的规律也不是我等凡人能看出来的。
说是SG裸题吧但是这个sg数组又不太好找规律,不过借此学了以下sg函数,和nim一个原理,当每组取的解是固定的的时候就可以开心模板sg,一旦像此题一样,只能打表找规律了。这个表一般很好打,但是规律毕竟不是我等凡人可以触及的。
此题打表之后可以轻松(并不)地发现,如果这个数是质数那么sg【x】=质数排名,一旦不是质数那么sg【x】=sg【x的最小质因子】。
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll MAXN=1e6+5;
int Hash[MAXN],C[505];
int f[MAXN],sg[MAXN],vis[100];
void getSG(int n){ //打表前20项找规律
memset(sg,0,sizeof(sg));
for(int i=1;i<=n;i++){
memset(vis,0,sizeof(vis));
for(int j=1;j<=i;j++){
if((__gcd(i,j)==1||i==j)){
vis[sg[j]]=1;
}
}
int Min=0x7fffffff;
for(int j=1;j<=i;j++){
if(!vis[j]){
sg[i]=j;break;
}
}
}
}
int vis2[MAXN];
void getsg(int n) ///根据规律正儿八经求sg
{
memset(vis2,0,sizeof(vis2));
int cnt=1;sg[0]=0;sg[1]=1;
for(int i=2;i<=n;i++){
if(!vis2[i]){
sg[i]=++cnt; ///是质数那么sg=质数排名
}
for(int j=2;j*i<n;j++){
if(!vis2[i*j]){
sg[i*j]=sg[i]; ///不是质数那么sg=最小质因子
vis2[i*j]=1;
}
}
}
}
int main()
{
int n;
// getSG(20);
getsg(1000000);
/*for(int i=1;i<=20;i++){
cout<<"sg["<<i<<"]"<<" : "<<sg[i]<<endl;
}*/
int t;
while(~scanf("%d",&t)){
while(t--)
{
scanf("%d",&n);
int ans=0;
for(int i=1;i<=n;i++){
scanf("%d",&C[i]);
ans^=sg[C[i]];
}
if(ans){
printf("Subconscious is our king!\n");
}
else{
printf("Long live with King Johann!\n");
}
}
}
}
I self-criticism three thousand!!!
I self-criticism three thousand!!!
I self-criticism three thousand!!!
I self-criticism three thousand!!!
I self-criticism three thousand!!!
I self-criticism three thousand!!!
I self-criticism three thousand!!!
I self-criticism three thousand!!!
I self-criticism three thousand!!!
I self-criticism three thousand!!!
I self-criticism three thousand!!!
I self-criticism three thousand!!!