Submission #1049250

#TimeUsernameProblemLanguageResultExecution timeMemory
1049250marExam (eJOI20_exam)C++14
12 / 100
70 ms3360 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 100008; int main() { int n; cin>>n; int ans=0; vector<int> a, b; bool flag = true; int inp; for(int i=0;i<n;i++) { cin>>inp; a.push_back(inp); if(i>0 && inp <= a[i-1]) flag=false; } for(int i=0;i<n;i++){ cin>>inp; b.push_back(inp); } for(int i=0; i<n; i++) { if(a[i] != inp)continue; int tmp = i-1; while(tmp >= 0 && a[tmp] <= inp) { ans++; tmp--; } while(i < n && a[i] <= inp) { ans++; i++; } } cout<<ans<<endl; return 0; }

Compilation message (stderr)

exam.cpp: In function 'int main()':
exam.cpp:11:7: warning: variable 'flag' set but not used [-Wunused-but-set-variable]
   11 |  bool flag = true;
      |       ^~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...