Submission #824608

# Submission time Handle Problem Language Result Execution time Memory
824608 2023-08-14T08:15:16 Z Amylopectin Sandcastle 2 (JOI22_ho_t5) C++14
15 / 100
5000 ms 1364 KB
#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
const long long mxn = 1e6 + 10;
struct we 
{
    long long nn,mm,val;
};
bool cmp(const struct we &l,const struct we &r)
{
    return l.val < r.val;
}
struct we poi[mxn] = {};
long long ta[mxn] = {};
long long ab(long long l)
{
    if(l < 0)
    {
        return -l;
    }
    return l;
}
int main()
{
    long long i,j,n,m,r,cn,cm,fn,fm,k,o,p,h,q,be,csu = 0,rn,rm,of;
    scanf("%lld %lld",&n,&m);
    r = n*m;
    for(i=0; i<n; i++)
    {
        for(j=0; j<m; j++)
        {
            cn = i*m + j;
            scanf("%lld",&poi[cn].val);
            poi[cn].nn = i;
            poi[cn].mm = j;
        }
    }
    sort(poi,poi+r,cmp);
    for(i=0; i<n; i++)
    {
        for(j=0; j<m; j++)
        {
            for(k=i; k<n; k++)
            {
                for(o=j; o<m; o++)
                {
                    rn = -1;
                    rm = -1;
                    of = 0;
                    for(h=0; h<r; h++)
                    {
                        cn = poi[h].nn;
                        cm = poi[h].mm;
                        if(cn >= i && cn <= k && cm >= j && cm <= o)
                        {
                            if(rn == -1)
                            {
                                rn = cn;
                                rm = cm;
                            }
                            else
                            {
                                if(ab(cn - rn) + ab(cm - rm) > 1)
                                {
                                    of = 1;
                                    break;
                                }
                                rn = cn;
                                rm = cm;
                            }
                        }
                    }
                    if(of == 0)
                    {
                        csu ++;
                        // printf("%d %d %d %d\n",i,j,k,o);
                    }
                }
            }
        }
    }
    printf("%lld\n",csu);
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:26:31: warning: unused variable 'fn' [-Wunused-variable]
   26 |     long long i,j,n,m,r,cn,cm,fn,fm,k,o,p,h,q,be,csu = 0,rn,rm,of;
      |                               ^~
Main.cpp:26:34: warning: unused variable 'fm' [-Wunused-variable]
   26 |     long long i,j,n,m,r,cn,cm,fn,fm,k,o,p,h,q,be,csu = 0,rn,rm,of;
      |                                  ^~
Main.cpp:26:41: warning: unused variable 'p' [-Wunused-variable]
   26 |     long long i,j,n,m,r,cn,cm,fn,fm,k,o,p,h,q,be,csu = 0,rn,rm,of;
      |                                         ^
Main.cpp:26:45: warning: unused variable 'q' [-Wunused-variable]
   26 |     long long i,j,n,m,r,cn,cm,fn,fm,k,o,p,h,q,be,csu = 0,rn,rm,of;
      |                                             ^
Main.cpp:26:47: warning: unused variable 'be' [-Wunused-variable]
   26 |     long long i,j,n,m,r,cn,cm,fn,fm,k,o,p,h,q,be,csu = 0,rn,rm,of;
      |                                               ^~
Main.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |     scanf("%lld %lld",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
Main.cpp:34:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |             scanf("%lld",&poi[cn].val);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 5077 ms 1364 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1814 ms 344 KB Output is correct
8 Correct 32 ms 340 KB Output is correct
9 Correct 84 ms 340 KB Output is correct
10 Correct 1092 ms 344 KB Output is correct
11 Correct 1453 ms 340 KB Output is correct
12 Correct 1486 ms 360 KB Output is correct
13 Correct 411 ms 340 KB Output is correct
14 Correct 123 ms 340 KB Output is correct
15 Correct 248 ms 344 KB Output is correct
16 Correct 98 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1814 ms 344 KB Output is correct
8 Correct 32 ms 340 KB Output is correct
9 Correct 84 ms 340 KB Output is correct
10 Correct 1092 ms 344 KB Output is correct
11 Correct 1453 ms 340 KB Output is correct
12 Correct 1486 ms 360 KB Output is correct
13 Correct 411 ms 340 KB Output is correct
14 Correct 123 ms 340 KB Output is correct
15 Correct 248 ms 344 KB Output is correct
16 Correct 98 ms 340 KB Output is correct
17 Execution timed out 5019 ms 468 KB Time limit exceeded
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1814 ms 344 KB Output is correct
8 Correct 32 ms 340 KB Output is correct
9 Correct 84 ms 340 KB Output is correct
10 Correct 1092 ms 344 KB Output is correct
11 Correct 1453 ms 340 KB Output is correct
12 Correct 1486 ms 360 KB Output is correct
13 Correct 411 ms 340 KB Output is correct
14 Correct 123 ms 340 KB Output is correct
15 Correct 248 ms 344 KB Output is correct
16 Correct 98 ms 340 KB Output is correct
17 Execution timed out 5019 ms 468 KB Time limit exceeded
18 Halted 0 ms 0 KB -