답안 #594076

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
594076 2022-07-12T04:57:23 Z 반딧불(#8432) Sandcastle 2 (JOI22_ho_t5) C++17
10 / 100
5000 ms 6356 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

struct dat{
    int x, y, v;
    dat(){}
    dat(int x, int y, int v): x(x), y(y), v(v){}
    bool operator<(const dat &r)const{
        return v<r.v;
    }
};

int n, m;
int arr[1502][1502];
ll ans;

int main(){
    scanf("%d %d", &n, &m);
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            scanf("%d", &arr[i][j]);
        }
    }
    for(int a=1; a<=n; a++){
        for(int b=a; b<=n; b++){
            for(int c=1; c<=m; c++){
                for(int d=c; d<=m; d++){
                    vector<dat> v;
                    for(int i=a; i<=b; i++) for(int j=c; j<=d; j++) v.push_back(dat(i, j, arr[i][j]));
                    sort(v.begin(), v.end());
                    bool able = 1;
                    for(int i=0; i<(int)v.size()-1; i++){
                        if(abs(v[i].x-v[i+1].x)+abs(v[i].y-v[i+1].y) != 1){
                            able = 0;
                            break;
                        }
                    }
                    if(able) ans++;
                }
            }
        }
    }
    printf("%lld", ans);
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:24:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |             scanf("%d", &arr[i][j]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 5069 ms 1556 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 308 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 308 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Execution timed out 5096 ms 6356 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 308 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Execution timed out 5096 ms 6356 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 308 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Execution timed out 5096 ms 6356 KB Time limit exceeded
8 Halted 0 ms 0 KB -