# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
403468 | 2021-05-13T08:11:18 Z | tqbfjotld | 조개 줍기 (KOI17_shell) | C++14 | 2000 ms | 35616 KB |
///subtask #include <bits/stdc++.h> using namespace std; #define int long long int vals[1505][1505]; int val2[1505][1505]; int num[1505][1505]; main(){ int n; scanf("%lld",&n); for (int x = 0; x<n; x++){ for (int y = 0; y<n; y++){ scanf("%lld",&vals[x][y]); } } for (int x = 0; x<n; x++){ for (int y = 0; y<n; y++){ if (x==0){ if (y==0) val2[x][y] = vals[x][y]; else val2[x][y] = vals[x][y]+val2[x][y-1]; } else if (y==0){ val2[x][y] = vals[x][y]+val2[x-1][y]; } else{ val2[x][y] = vals[x][y]+max(val2[x-1][y],val2[x][y-1]); } } } int curans = 0; for (int x = 0; x<n; x++){ for (int y = 0; y<n; y++){ curans += val2[x][y]; } } printf("%lld\n",curans); for (int x = 0; x<n; x++){ char c; int a,b; scanf(" %c%lld%lld",&c,&a,&b); if (c=='U'){ vals[a-1][b-1]++; } else{ vals[a-1][b-1]--; } for (int x = 0; x<n; x++){ for (int y = 0; y<n; y++){ if (x==0){ if (y==0) val2[x][y] = vals[x][y]; else val2[x][y] = vals[x][y]+val2[x][y-1]; } else if (y==0){ val2[x][y] = vals[x][y]+val2[x-1][y]; } else{ val2[x][y] = vals[x][y]+max(val2[x-1][y],val2[x][y-1]); } } } int curans = 0; for (int x = 0; x<n; x++){ for (int y = 0; y<n; y++){ curans += val2[x][y]; } } printf("%lld\n",curans); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 1228 KB | Output is correct |
2 | Correct | 9 ms | 1256 KB | Output is correct |
3 | Correct | 7 ms | 1256 KB | Output is correct |
4 | Correct | 7 ms | 1252 KB | Output is correct |
5 | Correct | 7 ms | 1152 KB | Output is correct |
6 | Correct | 8 ms | 1260 KB | Output is correct |
7 | Correct | 7 ms | 1228 KB | Output is correct |
8 | Correct | 8 ms | 1228 KB | Output is correct |
9 | Correct | 7 ms | 1228 KB | Output is correct |
10 | Correct | 8 ms | 1228 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2097 ms | 35616 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 1228 KB | Output is correct |
2 | Correct | 9 ms | 1256 KB | Output is correct |
3 | Correct | 7 ms | 1256 KB | Output is correct |
4 | Correct | 7 ms | 1252 KB | Output is correct |
5 | Correct | 7 ms | 1152 KB | Output is correct |
6 | Correct | 8 ms | 1260 KB | Output is correct |
7 | Correct | 7 ms | 1228 KB | Output is correct |
8 | Correct | 8 ms | 1228 KB | Output is correct |
9 | Correct | 7 ms | 1228 KB | Output is correct |
10 | Execution timed out | 2097 ms | 35616 KB | Time limit exceeded |
11 | Halted | 0 ms | 0 KB | - |