Submission #2214019


Source Code Expand

#include <iostream>
#include <cstdio>
using namespace std;

int p[52][52],ans[2502];

int main() {
  int N;
  scanf("%d",&N);
  for (int i=1; i<=N; i++) {
    for (int j=1; j<=N; j++) {
      int x;
      scanf("%d",&x);
      p[i][j]=p[i-1][j]+x;
    }
  }
  for (int is=1; is<=N; is++) {
    for (int ie=is; ie<=N; ie++) {
      for (int js=1; js<=N; js++) {
        int s=0,w=0;
        for (int je=js; je<=N; je++) {
          s+=p[ie][je]-p[is-1][je];
          w+=ie-is+1;
          if (s>ans[w]) {
            ans[w]=s;
          }
        }
      }
    }
  }
  for (int i=2; i<=N*N; i++) {
    if (ans[i-1]>ans[i]) {
      ans[i]=ans[i-1];
    }
  }
  int Q;
  scanf("%d",&Q);
  while (Q--) {
    int x;
    scanf("%d",&x);
    printf("%d\n",ans[x]);
  }
  return 0;
}

Submission Info

Submission Time
Task D - おいしいたこ焼きの焼き方
User tom123
Language C++14 (GCC 5.4.1)
Score 100
Code Size 823 Byte
Status AC
Exec Time 5 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:9:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&N);
                 ^
./Main.cpp:13:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
       scanf("%d",&x);
                     ^
./Main.cpp:37:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&Q);
                 ^
./Main.cpp:40:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&x);
                   ^

Judge Result

Set Name Subtask1 Subtask2
Score / Max Score 50 / 50 50 / 50
Status
AC × 18
AC × 20
Set Name Test Cases
Subtask1 sub0.txt, sub1.txt, sub2.txt, sub_rand_max0.txt, sub_rand_max1.txt, sub_rand_max2.txt, sub_rand_max3.txt, sub_rand_min0.txt, s1.txt, s2.txt, sub0.txt, sub1.txt, sub2.txt, sub_rand_max0.txt, sub_rand_max1.txt, sub_rand_max2.txt, sub_rand_max3.txt, sub_rand_min0.txt
Subtask2 rand0.txt, rand1.txt, rand2.txt, rand3.txt, rand4.txt, rand_max0.txt, rand_max1.txt, rand_max2.txt, rand_max3.txt, rand_max4.txt, s1.txt, s2.txt, sub0.txt, sub1.txt, sub2.txt, sub_rand_max0.txt, sub_rand_max1.txt, sub_rand_max2.txt, sub_rand_max3.txt, sub_rand_min0.txt
Case Name Status Exec Time Memory
rand0.txt AC 3 ms 256 KB
rand1.txt AC 2 ms 256 KB
rand2.txt AC 3 ms 256 KB
rand3.txt AC 2 ms 256 KB
rand4.txt AC 1 ms 256 KB
rand_max0.txt AC 5 ms 256 KB
rand_max1.txt AC 5 ms 256 KB
rand_max2.txt AC 5 ms 256 KB
rand_max3.txt AC 5 ms 256 KB
rand_max4.txt AC 5 ms 256 KB
s1.txt AC 1 ms 256 KB
s2.txt AC 1 ms 256 KB
sub0.txt AC 1 ms 256 KB
sub1.txt AC 1 ms 256 KB
sub2.txt AC 1 ms 256 KB
sub_rand_max0.txt AC 1 ms 256 KB
sub_rand_max1.txt AC 1 ms 256 KB
sub_rand_max2.txt AC 1 ms 256 KB
sub_rand_max3.txt AC 1 ms 256 KB
sub_rand_min0.txt AC 1 ms 256 KB