Submission #86252

# Submission time Handle Problem Language Result Execution time Memory
86252 2018-11-25T15:18:53 Z tjdgus4384 None (KOI17_shell) C++14
12 / 100
2000 ms 23152 KB
#include<cstdio>
#include<algorithm>
using namespace std;
int board[1501][1501], boardsum[1501][1501];
char x;
int n;

void sum()
{
    int ans = 0;
    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= n;j++)
        {
            boardsum[i][j] = board[i][j] + max(boardsum[i - 1][j], boardsum[i][j - 1]);
            ans += boardsum[i][j];
        }
    }
    printf("%d\n", ans);
}

int main()
{
    int a, b;
    scanf("%d", &n);
    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= n;j++)
        {
            scanf("%d", &board[i][j]);
        }
    }
    sum();
    for(int i = 0;i < n;i++)
    {
        scanf(" %c", &x);
        scanf("%d %d", &a, &b);
        if(x == 'U') board[a][b]++;
        else board[a][b]--;
        sum();
    }
    return 0;
}

Compilation message

shell.cpp: In function 'int main()':
shell.cpp:25:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
shell.cpp:30:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &board[i][j]);
             ~~~~~^~~~~~~~~~~~~~~~~~~~
shell.cpp:36:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" %c", &x);
         ~~~~~^~~~~~~~~~~
shell.cpp:37:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &a, &b);
         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1144 KB Output is correct
2 Correct 8 ms 1308 KB Output is correct
3 Correct 7 ms 1516 KB Output is correct
4 Correct 8 ms 1688 KB Output is correct
5 Correct 7 ms 1688 KB Output is correct
6 Correct 8 ms 1688 KB Output is correct
7 Correct 7 ms 1688 KB Output is correct
8 Correct 7 ms 1688 KB Output is correct
9 Correct 7 ms 1796 KB Output is correct
10 Correct 7 ms 1880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2032 ms 23152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1144 KB Output is correct
2 Correct 8 ms 1308 KB Output is correct
3 Correct 7 ms 1516 KB Output is correct
4 Correct 8 ms 1688 KB Output is correct
5 Correct 7 ms 1688 KB Output is correct
6 Correct 8 ms 1688 KB Output is correct
7 Correct 7 ms 1688 KB Output is correct
8 Correct 7 ms 1688 KB Output is correct
9 Correct 7 ms 1796 KB Output is correct
10 Execution timed out 2032 ms 23152 KB Time limit exceeded
11 Halted 0 ms 0 KB -