답안 #594104

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
594104 2022-07-12T05:58:42 Z 이동현(#8435) Sandcastle 2 (JOI22_ho_t5) C++17
10 / 100
5000 ms 1736 KB
#include <bits/stdc++.h>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m; cin >> n >> m;
    vector<vector<int>> a(n, vector<int>(m));
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            cin >> a[i][j];
        }
    }
    int ans = 0;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            for(int x = i; x < n; ++x){
                for(int y = j; y < m; ++y){
                    vector<vector<int>> srt;
                    for(int xx = i; xx <= x; ++xx){
                        for(int yy = j; yy <= y; ++yy){
                            srt.push_back({a[xx][yy], xx, yy});
                        }
                    }
                    sort(srt.begin(), srt.end());
                    int f = 1;
                    for(int k = 1; k < (int)srt.size(); ++k){
                        if(abs(srt[k][1] - srt[k - 1][1]) + abs(srt[k][2] - srt[k - 1][2]) != 1){
                            f = 0;
                            break;
                        }
                    }
                    ans += f;
                }
            }
        }
    }
    cout << ans << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 5052 ms 1736 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 4 ms 320 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 4 ms 320 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Execution timed out 5055 ms 484 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 4 ms 320 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Execution timed out 5055 ms 484 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 4 ms 320 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Execution timed out 5055 ms 484 KB Time limit exceeded
8 Halted 0 ms 0 KB -