Submission #824608

#TimeUsernameProblemLanguageResultExecution timeMemory
824608AmylopectinSandcastle 2 (JOI22_ho_t5)C++14
15 / 100
5077 ms1364 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...