Submission #63772870
Source Code Expand
Copy
#include <bits/stdc++.h>using namespace std;#include <ext/pb_ds/assoc_container.hpp>#include <ext/pb_ds/tree_policy.hpp>using namespace __gnu_pbds;template<class T>using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;#define sz(x) (int)(x).size()#define all(x) (x).begin(), (x).end()#define rall(x) (x).rbegin(), (x).rend()#define pb push_back#define x first#define y second#define FOR(i, a, b) for(int i = (a); i < (b); i++)#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)typedef long long ll;typedef double db;
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back #define x first #define y second #define FOR(i, a, b) for(int i = (a); i < (b); i++) #define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--) typedef long long ll; typedef double db; typedef long double LD; typedef pair<int, int> pii; typedef pair<db, db> pdd; typedef pair<ll, ll> pll; const int N = 3e5 + 47; int solve() { int n; if (!(cin >> n)) return 1; vector<int> a(n); FOR (i, 0, n) cin >> a[i]; int ans = 0; vector<int> L(N), R(N); int l = 0, r = 0; FOR (i, 0, n) { L[a[i]]++; if (L[a[i]] == 1) l++; } FOR (i, 0, n - 1) { L[a[i]]--; if (L[a[i]] == 0) l--; R[a[i]]++; if (R[a[i]] == 1) r++; ans = max(ans, l + r); } cout << ans << '\n'; return 0; } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int TET = 1e9; //cin >> TET; for (int i = 1; i <= TET; i++) { if (solve()) { break; } #ifdef ONPC cerr << "_____________________________\n"; #endif } #ifdef ONPC cerr << "\nfinished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec\n"; #endif return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Variety Split Easy |
User | WeaRD276 |
Language | C++ 20 (gcc 12.2) |
Score | 350 |
Code Size | 1536 Byte |
Status | AC |
Exec Time | 19 ms |
Memory | 6516 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 350 / 350 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt, 01_test_32.txt, 01_test_33.txt, 01_test_34.txt, 01_test_35.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 2 ms | 5364 KB |
00_sample_01.txt | AC | 2 ms | 5424 KB |
01_test_00.txt | AC | 2 ms | 5428 KB |
01_test_01.txt | AC | 2 ms | 5392 KB |
01_test_02.txt | AC | 2 ms | 5428 KB |
01_test_03.txt | AC | 2 ms | 5364 KB |
01_test_04.txt | AC | 2 ms | 5328 KB |
01_test_05.txt | AC | 6 ms | 5552 KB |
01_test_06.txt | AC | 19 ms | 6460 KB |
01_test_07.txt | AC | 7 ms | 5892 KB |
01_test_08.txt | AC | 18 ms | 6372 KB |
01_test_09.txt | AC | 17 ms | 6416 KB |
01_test_10.txt | AC | 18 ms | 6384 KB |
01_test_11.txt | AC | 6 ms | 5664 KB |
01_test_12.txt | AC | 19 ms | 6504 KB |
01_test_13.txt | AC | 4 ms | 5664 KB |
01_test_14.txt | AC | 18 ms | 6428 KB |
01_test_15.txt | AC | 18 ms | 6344 KB |
01_test_16.txt | AC | 19 ms | 6472 KB |
01_test_17.txt | AC | 18 ms | 6384 KB |
01_test_18.txt | AC | 18 ms | 6432 KB |
01_test_19.txt | AC | 19 ms | 6480 KB |
01_test_20.txt | AC | 12 ms | 6460 KB |
01_test_21.txt | AC | 16 ms | 6344 KB |
01_test_22.txt | AC | 19 ms | 6432 KB |
01_test_23.txt | AC | 17 ms | 6412 KB |
01_test_24.txt | AC | 16 ms | 6428 KB |
01_test_25.txt | AC | 16 ms | 6432 KB |
01_test_26.txt | AC | 18 ms | 6516 KB |
01_test_27.txt | AC | 2 ms | 5392 KB |
01_test_28.txt | AC | 2 ms | 5448 KB |
01_test_29.txt | AC | 15 ms | 6444 KB |
01_test_30.txt | AC | 15 ms | 6480 KB |
01_test_31.txt | AC | 15 ms | 6344 KB |
01_test_32.txt | AC | 16 ms | 6456 KB |
01_test_33.txt | AC | 16 ms | 6412 KB |
01_test_34.txt | AC | 16 ms | 6432 KB |
01_test_35.txt | AC | 15 ms | 6416 KB |