Submission #824561

#TimeUsernameProblemLanguageResultExecution timeMemory
824561AmylopectinSandcastle 2 (JOI22_ho_t5)C++14
9 / 100
5 ms1064 KiB
#include <stdio.h> #include <iostream> #include <algorithm> using namespace std; const long long mxn = 1e6 + 10; long long ta[mxn] = {}; int main() { long long i,j,n,m,cn,cm,fn,fm,k,o,q,be,csu = 0; scanf("%lld %lld",&n,&m); csu = m; be = 0; for(i=0; i<m; i++) { scanf("%lld",&ta[i]); if(i > 1) { if((ta[i] - ta[i-1]) * (ta[i-1] - ta[i-2]) < 0) { cn = i-be; csu += cn * (cn-1) / 2; be = i-1; } } } cn = m-be; csu += cn * (cn-1) / 2; printf("%lld\n",csu); }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:10:17: warning: unused variable 'j' [-Wunused-variable]
   10 |     long long i,j,n,m,cn,cm,fn,fm,k,o,q,be,csu = 0;
      |                 ^
Main.cpp:10:26: warning: unused variable 'cm' [-Wunused-variable]
   10 |     long long i,j,n,m,cn,cm,fn,fm,k,o,q,be,csu = 0;
      |                          ^~
Main.cpp:10:29: warning: unused variable 'fn' [-Wunused-variable]
   10 |     long long i,j,n,m,cn,cm,fn,fm,k,o,q,be,csu = 0;
      |                             ^~
Main.cpp:10:32: warning: unused variable 'fm' [-Wunused-variable]
   10 |     long long i,j,n,m,cn,cm,fn,fm,k,o,q,be,csu = 0;
      |                                ^~
Main.cpp:10:35: warning: unused variable 'k' [-Wunused-variable]
   10 |     long long i,j,n,m,cn,cm,fn,fm,k,o,q,be,csu = 0;
      |                                   ^
Main.cpp:10:37: warning: unused variable 'o' [-Wunused-variable]
   10 |     long long i,j,n,m,cn,cm,fn,fm,k,o,q,be,csu = 0;
      |                                     ^
Main.cpp:10:39: warning: unused variable 'q' [-Wunused-variable]
   10 |     long long i,j,n,m,cn,cm,fn,fm,k,o,q,be,csu = 0;
      |                                       ^
Main.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%lld %lld",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
Main.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%lld",&ta[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
#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...