Fox Observation

题目链接

  • 题意:

    在无限大的二维平面上给n个点(点在方格内部),坐标均为整数值,每个点有一个值。现在需要选择一个矩形(定点坐标均为整数,切均在方格内部),值等于矩形内的点之和加上边上的点的和除以面积(面积大于0)

  • 分析:

    和CF上边的一道题有异曲同工之妙。对于长宽均为1的正方形,最多有四个点在里边,变长每增加一点,可以发现比值都会减少,所以直接找面积为1的即可

map<pair<int, int>, int> mp;

int main()
{
    int n, x, y, v;
    while (~RI(n))
    {
        REP(kase, n)
        {
            RIII(x, y, v);
            mp[MP(x, y)] += v;
            mp[MP(x - 1, y)] += v;
            mp[MP(x, y - 1)] += v;
            mp[MP(x - 1, y - 1)] += v;
        }
        int ans = 0;
        FC(it, mp)
        {
            ans = max(ans, it->second);
        }
        printf("%d / 1\n", ans);
    }
    return 0;
}
时间: 2024-10-21 11:12:11

Fox Observation的相关文章

CodeForces 388A Fox and Box Accumulation 贪心

Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cann

Codeforces Round #290 (Div. 2) C. Fox And Names 拓扑排序

C. Fox And Names time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: t

CodeForces510 C. Fox And Names(拓扑排序)

题目链接:http://codeforces.com/problemset/problem/510/C C. Fox And Names time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer S

CodeForces 510 B. Fox And Two Dots(DFS 啊)

题目链接:http://codeforces.com/problemset/problem/510/B Fox Ciel is playing a mobile puzzle game called "Two Dots". The basic levels are played on a board of size n?×?m cells, like this: Each cell contains a dot that has some color. We will use diff

CodeForces 510 A. Fox And Snake(模拟啊 )

题目链接:http://codeforces.com/problemset/problem/510/A Fox Ciel starts to learn programming. The first task is drawing a fox! However, that turns out to be too hard for a beginner, so she decides to draw a snake instead. A snake is a pattern on a n by m

网络流(最大流)CodeForces 512C:Fox And Dinner

Fox Ciel is participating in a party in Prime Kingdom. There are n foxes there (include Fox Ciel). The i-th fox is ai years old. They will have dinner around some round tables. You want to distribute foxes such that: Each fox is sitting at some table

UVaLive 6581 &amp;&amp; Gym 100299B What does the fox say? (模拟+STL)

题意:给定一些动物的叫声,然后再定某些动物的叫声,让你去除这些叫声后得到的叫声. 析:先存储所有的叫声,然后用map来记录其他的叫声,在输出时再判定一下就好. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #includ

2076 Problem F Quick Brown Fox

题目描述 A pangram is a phrase that includes at least one occurrence of each of the 26 letters, ‘a’. . .‘z’. You’re probably familiar with this one: “The quick brown fox jumps over the lazy dog.”Your job is to recognize pangrams. For phrases that don’t c

Fox And Two Dots

B - Fox And Two Dots Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description Fox Ciel is playing a mobile puzzle game called "Two Dots". The basic levels are played on a board of size n × m cel