# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
227352 |
2020-04-27T06:12:22 Z |
cgiosy |
None (KOI17_shell) |
C++17 |
|
118 ms |
9340 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, d=0;
cin>>t>>i>>l;
int r=l+1, x=t=='U' ? 1 : -1;
A[i][l]+=x;
while(r<=N && A[i-1][r]<A[i][r-1]) A[i][r++]+=x;
d+=r-l;
for(i++; i<=N; i++) {
while(l<r && A[i-1][l]<=A[i][l-1]) l++;
if(l==r) break;
while(r<=N && A[i-1][r]<A[i][r-1]+x) r++;
for(int j=l; j<r; j++) A[i][j]+=x;
d+=r-l;
}
cout<<(s+=x*d)<<'\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
768 KB |
Output is correct |
2 |
Incorrect |
6 ms |
768 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
118 ms |
9340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
768 KB |
Output is correct |
2 |
Incorrect |
6 ms |
768 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |