zoukankan      html  css  js  c++  java
  • 10.6洛谷月赛划水记

    Div1型选手。

    Div1 得分:10+24+25+76 = 135

    开题顺序 :(A-F-C-D-E)

    好像混进来个奇怪的东西。

    T1:noi

    秒了,直接把输入的那几个数加起来就可以,注意有笔试的初始分 (50) 分。

    Code

    #include<iostream>
    #include<cstdio>
    #include<algorithm>
    using namespace std;
    int a,b,c,d,e,f,g,h,i,ans;
    int main()
    {
    	scanf("%d%d%d%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f,&g,&h,&i);
    	ans = 50+a+b+c+d+e+f+g;
    	if(h == 1) ans += 5;
    	if(ans < i) printf("AFO
    ");
    	else printf("AKIOI
    ");
    }
    

    T6 rrusq

    ynoi的毒瘤题,不会写正解。

    不过有 (76pts) 的暴力分好评。

    我们可以 (O(n^2)) 预处理出 每个矩形覆盖的每个点,然后对询问跑一遍莫队就可以。

    (subtack2) 按上面的做法会 (MLE) ,主要是每个矩形覆盖的点可能会很多,导致 (vector) 开不下。

    这种情况特判一下, 枚举每个点看能否被矩形覆盖就可以。

    Code

    #include<iostream>
    #include<cstdio>
    #include<algorithm>
    #include<cmath>
    #include<vector>
    using namespace std;
    const int N = 1e5+10;
    int n,m,cntq,l,r,tmp,block;
    int L[110],R[110],pos[N],tong[10010],ans[1000010];
    vector<int> v[N];
    struct dian
    {
    	int x,y,w;
    }a[N];
    struct juxing
    {
    	int l1,l2,r1,r2;
    }jx[N];
    struct node
    {
    	int l,r,id;
    }q[1000010];
    inline int read()
    {
    	int s = 0,w = 1; char ch = getchar();
    	while(ch < '0' || ch > '9'){if(ch == '-') w = -1; ch = getchar();}
    	while(ch >= '0' && ch <= '9'){s = s * 10 + ch - '0'; ch = getchar();}
    	return s * w;
    }
    bool comp(node a,node b)
    {
    	if(pos[a.l] == pos[b.l])
    	{
    		return a.r < b.r;
    	}
    	return pos[a.l] < pos[b.l];
    }
    void add(int x)
    {
    	for(int j = 0; j < v[x].size(); j++)
    	{
    		int to = v[x][j];
    		tong[to]++;
    		if(tong[to] == 1) tmp += a[to].w;
    	}
    }
    void del(int x)
    {
    	for(int j = 0; j < v[x].size(); j++)
    	{
    		int to = v[x][j];
    		tong[to]--;
    		if(tong[to] == 0) tmp -= a[to].w;
    	}
    }
    int main()
    {
    	n = read();
    	for(int i = 1; i <= n; i++)
    	{
    		a[i].x = i;
    		a[i].y = read();
    		a[i].w = read();
    	}
    	m = read(); block = sqrt(m);
    	for(int i = 1; i <= m; i++)
    	{
    //		cout<<m<<" sdahfio"<<endl;
    		jx[i].l1 = read();
    		jx[i].l2 = read();
    		jx[i].r1 = read();
    		jx[i].r2 = read();
    		pos[i] = (i-1)/block + 1;
    		L[pos[i]] = 233333;
    	}
    	for(int i = 1; i <= m; i++)
    	{
    		L[pos[i]] = min(L[pos[i]],i);
    		R[pos[i]] = max(R[pos[i]],i);
    	}
    	cntq = read();
    	for(int i = 1; i <= cntq; i++)
    	{
    		q[i].l = read();
    		q[i].r = read();
    		q[i].id = i;
    	}
    	if(cntq == 1)
    	{
    		int res = 0;
    		for(int j = 1; j <= n; j++)
    		{
    			for(int i = q[1].l; i <= q[1].r; i++)
    			{
    				if(a[j].x >= jx[i].l1 && a[j].x <= jx[i].l2 && a[j].y >= jx[i].r1 && a[j].y <= jx[i].r2)
    				{
    					res += a[j].w;
    					break;
    				}
    			}
    		}
    		printf("%d
    ",res);
    		return 0;
    	}
    	for(int i = 1; i <= m; i++)
    	{
    		for(int j = 1; j <= n; j++)
    		{
    			if(a[j].x >= jx[i].l1 && a[j].x <= jx[i].l2 && a[j].y >= jx[i].r1 && a[j].y <= jx[i].r2)
    			{
    				v[i].push_back(j);
    			}
    		}
    	}
    	sort(q+1,q+cntq+1,comp);
    	l = 1, r = 0, tmp = 0;
    	for(int i = 1; i <= cntq; i++)
    	{
    		while(l < q[i].l) del(l++);
    		while(l > q[i].l) add(--l);
    		while(r < q[i].r) add(++r);
    		while(r > q[i].r) del(r--);
    		ans[q[i].id] = tmp;
    	}
    	for(int i = 1; i <= cntq; i++)
    	{
    		printf("%d
    ",ans[i]);
    	}
    	return 0;
    }
    

    这期间滚回去看 (Div2B) 发现是个神奇的贪心,但要分类讨论好多种情况,顿时就不想写了,还是滚回去做 (Div1) 吧。

    T3 mex

    这就构造题一点都不会呗。老老实实的打了个特判第二种情况就走人了。

    拿了 (10pts) 的暴力滚粗。

    T4 station

    好像考场上很多大佬都会写 (76pts) 的做法。

    但我这种构造小白来说,只会写 (24pts) 的做法。

    我们直接(O(n^2)) 连边就可以获得 (24) 分的暴力分滚粗了。

    T5 photo

    只会写 (O(n^2)) 的做法。不过这 (10^6) 的数据范围一看就不好做。

    总结:

    虽然这次月赛自己骗了不少分,但只做出来一道题,大失败。

    构造这种问题自己确实不太擅长,怎么办我也很无奈啊 QAQ.

    菜死了,该退役了。

    不过听别人说好像这次月赛的难度比之前的要大点。

  • 相关阅读:
    hdu 2647 Reward
    hdu 2094 产生冠军
    hdu 3342 Legal or Not
    hdu 1285 确定比赛名次
    hdu 3006 The Number of set
    hdu 1429 胜利大逃亡(续)
    UVA 146 ID Codes
    UVA 131 The Psychic Poker Player
    洛谷 P2491消防 解题报告
    洛谷 P2587 [ZJOI2008]泡泡堂 解题报告
  • 原文地址:https://www.cnblogs.com/genshy/p/13783561.html
Copyright © 2011-2022 走看看