Submission #833709

#TimeUsernameProblemLanguageResultExecution timeMemory
833709vjudge1Exam (eJOI20_exam)C++17
0 / 100
1082 ms3028 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; // os.erase(os.find_by_order(os.order_of_key(val))); #define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> #define MAX LLONG_MAX #define MOD 1000000007 #define int long long #define ll __int128 #define endl '\n' #define fi first #define se second #define pii pair<int, int> #define pb push_back #define all(x) x.begin(), x.end() #define pv(x) for (auto i : x) cout << i << ' '; cout << endl; #define vini(x, y) for (int i = 0; i < y; i++) cin >> x[i]; #define gcd(a,b) __gcd(a,b) #define lcm(a,b) (a * (b / gcd(a,b))) #define countonbit(a) __builtin_popcountll(a) using namespace std; void solve() { int a; cin >> a; int counter = 0; vector <int> arr(a), key(a); vini(arr, a); vini(key, a); vector <pii> arr2(a); // for (int i = 0; i < a; i++) arr2[i] = {arr2[i], i}; sort(all(arr2)); int k = key[0]; for (int i = 0; i < a; i++) { if (arr[i] == k) { for (int j = i - 1; j >= 0; j--) { if (arr[j] > arr[i]) break; arr[j] = arr[i]; } for (int j = i + 1; j < a; j++) { if (arr[j] > arr[i]) break; arr[j] = arr[i]; } } } for (auto i : arr) counter += i == k; cout << counter << endl; } int32_t main() { ios::sync_with_stdio(false); cin.tie(NULL); int a = 1; while(a--) solve(); }
#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...