Submission #63791294


Source Code Expand

Copy
#include<bits/stdc++.h>
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define endl '\n'
#define f(i,n) for(int i=0; i<n; i++)
#define rf(i,n) for(int i=n-1; i>=0; i--)
#define all(v) v.begin(),v.end()
#define mxe(v) *max_element(all(v))
#define mne(v) *min_element(all(v))
#define srt(v) sort(all(v))
#define Error(x...) { cout << "(" << #x << ")" << " = ( "; printIt(x); }
using namespace std;
void printv(vi v){ for(auto val: v) cout << val << ' '; cout << '\n';}
void prints(vector<string> v){ for(auto val: v) cout << val << ' '; cout << '\n';}
void solve(){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
 
#define int long long
 
#define vi vector<int>
#define vvi vector<vi>
#define endl '\n'
#define f(i,n) for(int i=0; i<n; i++)
#define rf(i,n) for(int i=n-1; i>=0; i--)
#define all(v) v.begin(),v.end()
#define mxe(v) *max_element(all(v))
#define mne(v) *min_element(all(v))
#define srt(v) sort(all(v))
#define Error(x...) { cout << "(" << #x << ")" << " = ( "; printIt(x); }
 
using namespace std;
 
void printv(vi v){ for(auto val: v) cout << val << ' '; cout << '\n';}
void prints(vector<string> v){ for(auto val: v) cout << val << ' '; cout << '\n';}

void solve(){
    int n;
    cin >> n;
    vi v (n);
    for(int &x: v)
    {
        cin>>x;
    }
    map<int, int> m1, m2;
    for(int x: v)   m2[x]++;

    int curr, res = 0;
    f(i, n)
    {
        if(m2[v[i]] == 1)   m2.erase(v[i]);
        else                m2[v[i]]--;
        m1[v[i]]++;
        res = max(res, (int)(m1.size() + m2.size()));
    }
    cout<<res<<endl;
}


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    // cin >> t;
    while(t--) solve();
}

Submission Info

Submission Time
Task C - Variety Split Easy
User aryanishappy
Language C++ 20 (gcc 12.2)
Score 350
Code Size 1145 Byte
Status AC
Exec Time 430 ms
Memory 24208 KB

Compile Error

Main.cpp: In function ‘void solve()’:
Main.cpp:32:9: warning: unused variable ‘curr’ [-Wunused-variable]
   32 |     int curr, res = 0;
      |         ^~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 350 / 350
Status
AC × 2
AC × 38
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 1 ms 3428 KB
00_sample_01.txt AC 1 ms 3484 KB
01_test_00.txt AC 1 ms 3444 KB
01_test_01.txt AC 1 ms 3484 KB
01_test_02.txt AC 1 ms 3628 KB
01_test_03.txt AC 1 ms 3480 KB
01_test_04.txt AC 1 ms 3568 KB
01_test_05.txt AC 61 ms 7864 KB
01_test_06.txt AC 348 ms 20344 KB
01_test_07.txt AC 83 ms 9084 KB
01_test_08.txt AC 344 ms 20112 KB
01_test_09.txt AC 286 ms 18332 KB
01_test_10.txt AC 342 ms 20212 KB
01_test_11.txt AC 58 ms 7524 KB
01_test_12.txt AC 396 ms 20252 KB
01_test_13.txt AC 31 ms 5828 KB
01_test_14.txt AC 394 ms 20176 KB
01_test_15.txt AC 217 ms 11528 KB
01_test_16.txt AC 278 ms 15216 KB
01_test_17.txt AC 313 ms 17308 KB
01_test_18.txt AC 333 ms 18596 KB
01_test_19.txt AC 348 ms 19456 KB
01_test_20.txt AC 11 ms 5376 KB
01_test_21.txt AC 16 ms 5432 KB
01_test_22.txt AC 16 ms 5448 KB
01_test_23.txt AC 16 ms 5484 KB
01_test_24.txt AC 16 ms 5452 KB
01_test_25.txt AC 145 ms 24116 KB
01_test_26.txt AC 430 ms 24072 KB
01_test_27.txt AC 1 ms 3552 KB
01_test_28.txt AC 1 ms 3360 KB
01_test_29.txt AC 123 ms 17352 KB
01_test_30.txt AC 70 ms 7472 KB
01_test_31.txt AC 46 ms 6188 KB
01_test_32.txt AC 143 ms 24144 KB
01_test_33.txt AC 142 ms 24208 KB
01_test_34.txt AC 143 ms 24144 KB
01_test_35.txt AC 143 ms 24120 KB


2025-04-03 (Thu)
21:12:18 +00:00