# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
833426 | 2023-08-22T05:32:25 Z | vjudge1 | Exam (eJOI20_exam) | C++17 | 65 ms | 1848 KB |
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") typedef long long ll; const ll MAXN = 1e5 + 5; const ll INF = 1e9; #define endl '\n' #define pll pair <ll, ll> #define fi first #define se second ll n; ll a [MAXN], b [MAXN]; int main(){ cin >> n; ll cnt2 = 0; for(ll i = 1; i <= n; i++){ cin >> a[i]; if(a[i-1] < a[i]) cnt2++; } ll cnt = 0; for(ll i = 1; i <= n; i++){ cin >> b[i]; if(b[1] == b[i]) cnt++; } // if(n <= 10){ // } if(cnt == n){ ll sblm = 0; bool ada = false; ll ans = 0; a[n+1] = 2*INF; for(ll i = 1; i <= n+1; i++){ if(a[i] == b[1]) ada = true; if(a[i] > b[1]){ if(ada){ // cout << i << " " << sblm << endl; ada = false; ans += i-sblm-1; } sblm = i; } } cout << ans << endl; exit(0); } if(cnt2 == n){ vector <ll> v; for(ll i = 1; i <= n; i++){ for(ll j = i; j <= n; j++){ if(a[j] == b[i]){ v.push_back(j); break; } } } vector <ll> mx; for(auto x : v){ ll tmp = 0; for(ll i = 0; i < mx.size(); i++){ if(v[i] > x) continue; tmp = max(tmp, mx[i]); } mx.push_back(tmp+1); } ll ans = 0; for(auto x : mx){ ans = max(ans, x); } cout << ans << endl; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 18 ms | 540 KB | Output is correct |
3 | Correct | 41 ms | 1584 KB | Output is correct |
4 | Correct | 26 ms | 1788 KB | Output is correct |
5 | Correct | 58 ms | 1740 KB | Output is correct |
6 | Correct | 30 ms | 1848 KB | Output is correct |
7 | Correct | 26 ms | 1744 KB | Output is correct |
8 | Correct | 65 ms | 1832 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 5 ms | 336 KB | Output is correct |
4 | Correct | 28 ms | 488 KB | Output is correct |
5 | Correct | 13 ms | 400 KB | Output is correct |
6 | Correct | 14 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |