Submission #5672

# Submission time Handle Problem Language Result Execution time Memory
5672 2014-05-10T15:17:29 Z ansol4328 고기잡이 (KOI13_fish) C++
18 / 18
500 ms 1088 KB
#include<stdio.h>
#include<algorithm>

int n, l, m, x[102], y[102], fish[102][4];
int max;

int input()
{
    int i;
    scanf("%d %d %d",&n,&l,&m);
    for(i=1 ; i<=m ; i++)
    {
        scanf("%d %d",&fish[i][1],&fish[i][2]);
        y[i]=fish[i][1], x[i]=fish[i][2];
    }
    std::sort(x+1,x+1+m);
    std::sort(y+1,y+1+m);
    return 0;
}

int process()
{
    int i, j, k, li, tx, ty, a, b, cnt;

    for(i=1 ; i<=m ; i++)
    {
        for(j=1 ; j<=m ; j++)
        {
            ty=y[i], tx=x[j];
            for(li=1 ; li<=l/2 ; li++)
            {
                a=li, b=(l/2)-li;
                cnt=0;
                for(k=1 ; k<=m ; k++)
                {
                    if(tx<=fish[k][2] && tx+a>=fish[k][2] && ty<=fish[k][1] && ty+b>=fish[k][1]) cnt++;
                }
                if(max<cnt) max=cnt;
                cnt=0;
                for(k=1 ; k<=m ; k++)
                {
                    if(tx<=fish[k][2] && tx+a>=fish[k][2] && ty>=fish[k][1] && ty-b<=fish[k][1]) cnt++;
                }
                if(max<cnt) max=cnt;
                cnt=0;
                for(k=1 ; k<=m ; k++)
                {
                    if(tx>=fish[k][2] && tx-a<=fish[k][2] && ty>=fish[k][1] && ty-b<=fish[k][1]) cnt++;
                }
                if(max<cnt) max=cnt;
                cnt=0;
                for(k=1 ; k<=m ; k++)
                {
                    if(tx>=fish[k][2] && tx-a<=fish[k][2] && ty<=fish[k][1] && ty+b>=fish[k][1]) cnt++;
                }
                if(max<cnt) max=cnt;
            }
        }
    }
    return 0;
}

int output()
{
    printf("%d",max);
    return 0;
}

int main()
{
    input();
    process();
    output();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
3 Correct 0 ms 1088 KB Output is correct
4 Correct 0 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
3 Correct 0 ms 1088 KB Output is correct
4 Correct 16 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 1088 KB Output is correct
2 Correct 36 ms 1088 KB Output is correct
3 Correct 96 ms 1088 KB Output is correct
4 Correct 196 ms 1088 KB Output is correct
5 Correct 4 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 304 ms 1088 KB Output is correct
3 Correct 292 ms 1088 KB Output is correct
4 Correct 284 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 484 ms 1088 KB Output is correct
2 Correct 256 ms 1088 KB Output is correct
3 Correct 364 ms 1088 KB Output is correct
4 Correct 500 ms 1088 KB Output is correct