답안 #227373

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
227373 2020-04-27T07:59:07 Z cgiosy 조개 줍기 (KOI17_shell) C++17
46 / 100
2000 ms 13944 KB
#include <bits/stdc++.h>
using namespace std;

alignas(64) int A[1520][1520]{};
int main() {
	ios::sync_with_stdio(0);cin.tie(0);
	int N; long long s=0;
	cin>>N;
	for(int i=1; i<=N; i++) for(int j=1; j<=N; j++) {
		cin>>A[i][j];
		s+=A[i][j]+=max(A[i-1][j], A[i][j-1]);
	}
	cout<<s<<'\n';
	for(int q=0; q<N; q++) {
		char t;
		int i, l;
		cin>>t>>i>>l;
		int r=l+1;
		if(t=='U') while(l<r) {
			while(r<=N && A[i-1][r]<A[i][r-1]+1) r++;
			for(int j=l; j<r; j++) A[i][j]++;
			s+=r-l;
			if(++i>N) break;
			while(l<r && A[i-1][l]<=A[i][l-1]) l++;
		} else while(l<r) {
			while(r<=N && A[i-1][r]<=A[i][r-1]-1) r++;
			for(int j=l; j<r; j++) A[i][j]--;
			s-=r-l;
			if(++i>N) break;
			while(l<r && A[i-1][l]<A[i][l-1]) l++;
		}
		cout<<s<<'\n';
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 768 KB Output is correct
2 Correct 6 ms 768 KB Output is correct
3 Correct 6 ms 768 KB Output is correct
4 Correct 7 ms 768 KB Output is correct
5 Correct 7 ms 768 KB Output is correct
6 Correct 7 ms 768 KB Output is correct
7 Correct 5 ms 768 KB Output is correct
8 Correct 6 ms 768 KB Output is correct
9 Correct 6 ms 768 KB Output is correct
10 Correct 6 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 180 ms 9304 KB Output is correct
2 Correct 183 ms 9264 KB Output is correct
3 Correct 176 ms 13468 KB Output is correct
4 Correct 166 ms 13760 KB Output is correct
5 Correct 171 ms 13736 KB Output is correct
6 Correct 200 ms 13944 KB Output is correct
7 Correct 161 ms 13688 KB Output is correct
8 Correct 165 ms 13792 KB Output is correct
9 Correct 169 ms 13664 KB Output is correct
10 Correct 192 ms 13808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 768 KB Output is correct
2 Correct 6 ms 768 KB Output is correct
3 Correct 6 ms 768 KB Output is correct
4 Correct 7 ms 768 KB Output is correct
5 Correct 7 ms 768 KB Output is correct
6 Correct 7 ms 768 KB Output is correct
7 Correct 5 ms 768 KB Output is correct
8 Correct 6 ms 768 KB Output is correct
9 Correct 6 ms 768 KB Output is correct
10 Correct 180 ms 9304 KB Output is correct
11 Correct 183 ms 9264 KB Output is correct
12 Correct 176 ms 13468 KB Output is correct
13 Correct 166 ms 13760 KB Output is correct
14 Correct 171 ms 13736 KB Output is correct
15 Correct 200 ms 13944 KB Output is correct
16 Correct 161 ms 13688 KB Output is correct
17 Correct 165 ms 13792 KB Output is correct
18 Correct 169 ms 13664 KB Output is correct
19 Correct 192 ms 13808 KB Output is correct
20 Correct 266 ms 13664 KB Output is correct
21 Correct 217 ms 9296 KB Output is correct
22 Correct 207 ms 11932 KB Output is correct
23 Execution timed out 2060 ms 9312 KB Time limit exceeded
24 Halted 0 ms 0 KB -