Submission #462317

#TimeUsernameProblemLanguageResultExecution timeMemory
462317bigoExam (eJOI20_exam)C++14
12 / 100
89 ms1348 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long typedef pair<int, int> pii; int main() { int n; cin >> n; vector<int>a(n), b(n); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } vector<int>vec; for (int i = 0; i < n; i++) { if (a[i] == b[0]) vec.push_back(i); } int ans = 0; vector<bool>ok(n, false); for (int i = 0; i < vec.size(); i++) { if (!ok[vec[i]]) { for (int j = vec[i]; j >= 0; j--) { if (a[j] <= b[0]) ok[j] = true; else break; } for (int j = vec[i]; j <n; j++) { if (a[j] <= b[0]) ok[j] = true; else break; } } } for (int i = 0; i < n; i++) if (ok[i]) ans++; cout << ans; }

Compilation message (stderr)

exam.cpp: In function 'int main()':
exam.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for (int i = 0; i < vec.size(); 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...
#Verdict Execution timeMemoryGrader output
Fetching results...