Submission #676647

#TimeUsernameProblemLanguageResultExecution timeMemory
676647owoovoSandcastle 2 (JOI22_ho_t5)C++14
0 / 100
0 ms312 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; int ori[500010]; int main(){ ll n,m; cin>>n>>m; if(n!=1){ cout<<"0\n"; return 0; } for(int i=0;i<m;i++){ cin>>ori[i]; } ll ans=0; ll nowc=2; for(int i=2;i<m;i++){ if(ori[i]>ori[i-1]^ori[i-1]>ori[i-2]){ ans+=nowc*(nowc-1)/2+nowc-1; nowc=2; }else{ nowc++; } } ans+=nowc*(nowc-1)/2+nowc; cout<<ans<<'\n'; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:18:18: warning: suggest parentheses around comparison in operand of '^' [-Wparentheses]
   18 |         if(ori[i]>ori[i-1]^ori[i-1]>ori[i-2]){
      |            ~~~~~~^~~~~~~~~
#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...