# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
764149 |
2023-06-23T07:49:34 Z |
vjudge1 |
Exam (eJOI20_exam) |
C++14 |
|
1000 ms |
392748 KB |
//srand(time(0)) - always changing
//order_of_key(k): Number of items strictly smaller than k .
//find_by_order(k): K-th element in a set (counting from zero).
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fopen(s) freopen(s".in","r",stdin);freopen(s".out","w",stdout)
#define all(x) (x).begin(), (x).end()
#define len(x) (int)x.size()
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define elif else if
#define F first
#define S second
#define int long long
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
const int MOD = 1e9 + 7;
const int N = 2e5 + 7;
const int P = 911;
const ll INF = 1e18;
int gcd(int a, int b) {
while (b) {
a %= b;
swap (a, b);
}
return a;
}
ll __sqrt(ll x) {
ll result = 0;
for (ll k = 1ll << 30; k != 0; k >>= 1) {
if ((result + k) * (result + k) <= x) {
result += k;
}
}
return result;
}
int n, ans = 0;
vector <int> a, b;
void rec(vector <int> a) {
for (int i = 0; i < n; i++) {
int mn = a[i];
int mx = a[i];
for (int j = i + 1; j < n; j++) {
mn = min(mn, a[j]);
mx = max(mx, a[j]);
if (mn < mx) {
vector <int> act = a;
for (int k = i; k <= j; k++) {
act[k] = mx;
}
rec(act);
}
}
}
int cnt = 0;
for (int i = 0; i < n; i++) {
if (a[i] == b[i]) cnt++;
}
ans = max(ans, cnt);
}
void solve() {
cin >> n;
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
a.pb(x);
}
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
b.pb(x);
}
rec(a);
cout << ans;
}
const bool Cases = 0;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int TT = 1;
if (Cases) cin >> TT;
while (TT--) {
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
14 ms |
316 KB |
Output is correct |
4 |
Correct |
13 ms |
312 KB |
Output is correct |
5 |
Execution timed out |
1085 ms |
212 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1073 ms |
15956 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1071 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1099 ms |
392748 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
14 ms |
316 KB |
Output is correct |
4 |
Correct |
13 ms |
312 KB |
Output is correct |
5 |
Execution timed out |
1085 ms |
212 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
14 ms |
316 KB |
Output is correct |
4 |
Correct |
13 ms |
312 KB |
Output is correct |
5 |
Execution timed out |
1085 ms |
212 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |