Submission #49523

# Submission time Handle Problem Language Result Execution time Memory
49523 2018-05-30T07:25:00 Z leejseo None (KOI17_shell) C++17
0 / 100
256 ms 35856 KB
#include <stdio.h>
#include <algorithm>
using namespace std;
 
int N, A[1501][1501], DP[1501][1501];
 
void init(){
	scanf("%d", &N);
	for (int i=0; i<N; i++){
		for (int j=0; j<N; j++){
			scanf("%d", &A[i][j]);
		}
	}
}
 
long long query(bool molamola){
	if (molamola){
		char a; 
		int i, j;
		scanf("%c ", &a);
		scanf("%d%d", &i, &j);
		A[i][j] += (a == 'U'? 1 : -1);
	}
	long long s = 0;
	for (int i=0; i<N; i++){
		for (int j=0; j<N; j++){
			DP[i][j] = A[i][j] + (i == 0? (j == 0? 0 : DP[i][j-1]) : (j == 0? DP[i-1][j] : max(DP[i-1][j], DP[i][j-1])));
			s += DP[i][j];
		}
	}
	return s;
}
 
int main(void){
	init();
	printf("%lld\n", query(false));
	for (int i=0; i<N; i++) printf("%lld\n", query(true));
}

Compilation message

shell.cpp: In function 'void init()':
shell.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
shell.cpp:11:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &A[i][j]);
    ~~~~~^~~~~~~~~~~~~~~~
shell.cpp: In function 'long long int query(bool)':
shell.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%c ", &a);
   ~~~~~^~~~~~~~~~~
shell.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &i, &j);
   ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 256 ms 35856 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -