Submission #159710

# Submission time Handle Problem Language Result Execution time Memory
159710 2019-10-24T04:23:10 Z geon040702 고기잡이 (KOI13_fish) C++14
18 / 18
132 ms 508 KB
#include <bits/stdc++.h>
using namespace std;

#define inside(a, b, c) ((a)<=(c) && (c)<=(b))

int X[1000], Y[1000];
int Fx[1000], Fy[1000];

int main(void)
{
    int N, M, L;
    int i, j, k;
    int w, h, cnt;
    int res = 0;

    scanf("%d %d %d", &N, &L, &M);

    for (i = 0 ; i < M ; i++) {
        scanf("%d %d", &Fx[i], &Fy[i]);
        X[i] = Fx[i];
        Y[i] = Fy[i];
    }

    std::sort(X, X+M);
    std::sort(Y, Y+M);

    L /= 2;

    for (w = 1 ; w < L ; w++) {
        h = L - w;
        for (i = 0 ; i < M ; i++) {
              for (j = 0 ; j < M ; j++) {
                  cnt = 0;
                  for (k = 0 ; k < M ; k++) {
                      if (inside(X[i], X[i] + w, Fx[k]) && inside(Y[j], Y[j] + h, Fy[k]))
                            cnt++;
                  }
                  if(res < cnt)
                      res = cnt;
              }
        }
    }

    printf("%d", res);

    return 0;
}

Compilation message

fish.cpp: In function 'int main()':
fish.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d", &N, &L, &M);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
fish.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &Fx[i], &Fy[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 376 KB Output is correct
2 Correct 8 ms 380 KB Output is correct
3 Correct 18 ms 412 KB Output is correct
4 Correct 44 ms 412 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 64 ms 380 KB Output is correct
3 Correct 65 ms 508 KB Output is correct
4 Correct 74 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 118 ms 384 KB Output is correct
2 Correct 73 ms 376 KB Output is correct
3 Correct 95 ms 376 KB Output is correct
4 Correct 132 ms 376 KB Output is correct