|
| 1 | +/* |
| 2 | +Problem Name: Canvas Frames |
| 3 | +Problem Type: B - 1000 |
| 4 | +Problem Link: https://codeforces.com/problemset/problem/127/B |
| 5 | +Author: Jash Desai (jash13desai) |
| 6 | +*/ |
| 7 | +// ---------- HEADER ---------- |
| 8 | +#include<bits/stdc++.h> |
| 9 | +using namespace std; |
| 10 | +// ---------- TEMPLATES ---------- |
| 11 | +template<typename... T> |
| 12 | +void see(T&... args) { ((cin >> args), ...);} |
| 13 | +template<typename... T> |
| 14 | +void put(T&&... args) { ((cout << args << " "), ...);} |
| 15 | +template<typename... T> |
| 16 | +void putl(T&&... args) { ((cout << args << " "), ...); cout<<'\n';} |
| 17 | +// ---------- MACROS ---------- |
| 18 | +#define int long long |
| 19 | +#define pb push_back |
| 20 | +#define mp make_pair |
| 21 | +#define ff first |
| 22 | +#define ss second |
| 23 | +#define ll long long |
| 24 | +#define ld long double |
| 25 | +#define ull unsigned long long |
| 26 | +#define print(x) cout << (x) |
| 27 | +#define sz size() |
| 28 | +#define vc(x) vector<x> |
| 29 | +#define nl cout<<'\n' |
| 30 | +#define sqof(a) (a)*(a) |
| 31 | +#define vi vector<int> |
| 32 | +#define vvi vector<vector<int>> |
| 33 | +#define pii pair<int,int> |
| 34 | +#define vii vector<pii> |
| 35 | +#define IOS ios_base:: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cin.exceptions(cin.failbit) |
| 36 | +#define all(x) (x).begin(), (x).end() |
| 37 | +#define setpr(x) cout<<setprecision(x)<<fixed |
| 38 | +#define setbits(x) builtin_popcount((x)) |
| 39 | +#define tostr(x) to_string(x) |
| 40 | +#define rep(i,a,b) for(int i=a; i<b; i++) |
| 41 | +#define seeArr(arr,n) for(int i=0;i<n;i++){cin>>arr[i];} |
| 42 | +#define seeVi(v) for(int i=0;i<v.sz;i++){int x; cin>>x; v.pb(x);} |
| 43 | +#define seevi(v) for(int i=0;i<v.sz;i++){cin>>v[i];} |
| 44 | +// ---------- DEBUG ---------- |
| 45 | +#ifndef ONLINE_JUDGE |
| 46 | +#define debug(x) cerr << #x <<" : "; _print(x); cerr << '\n'; |
| 47 | +#else |
| 48 | +#define debug(x) |
| 49 | +#endif |
| 50 | +void _print(int t) {cerr << t;} |
| 51 | +void _print(string t) {cerr << t;} |
| 52 | +void _print(char t) {cerr << t;} |
| 53 | +void _print(ld t) {cerr << t;} |
| 54 | +void _print(double t) {cerr << t;} |
| 55 | +void _print(ull t) {cerr << t;} |
| 56 | +void _print(bool t) {cerr << t;} |
| 57 | +void _print(pair<int, int> t) {cerr << "[ " << t.ff << ", " << t.ss << " ]"; nl;} |
| 58 | +template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} |
| 59 | +// ---------- CONSTANTS ---------- |
| 60 | +const ll infmax = INT_MAX; |
| 61 | +const ll infmin = INT_MIN; |
| 62 | +const ll N1 = 1e3+2; |
| 63 | +const ll N2 = 1e5+2; |
| 64 | +const ld ep = 0.0000001; |
| 65 | +const ld pi = acos(-1.0); |
| 66 | +const ll md = 1000000007; |
| 67 | +// ---------- FUNCTIONS ---------- |
| 68 | +int gcd(int a, int b){return (!b) ? a : gcd(b, a % b);} |
| 69 | +int fact(int n){if(n==1 || n==0){return 1;} return (n*fact(n-1));} |
| 70 | +// ---------- SOLUTIONS ---------- |
| 71 | +void solve(){ |
| 72 | + int n; see(n); |
| 73 | + vi v(n); seevi(v); |
| 74 | + unordered_map<int,int> mp; |
| 75 | + rep(i,0,n){ |
| 76 | + mp[v[i]]++; |
| 77 | + } |
| 78 | + int ans = 0,two = 0; int d=0; |
| 79 | + for(auto x:mp){ |
| 80 | + d=x.ss; |
| 81 | + if(d>=2) two+=(d/2); |
| 82 | + } |
| 83 | + ans = two/2; |
| 84 | + put(ans); |
| 85 | +} |
| 86 | +// ---------- MAIN ---------- |
| 87 | +signed main() { |
| 88 | +#ifndef ONLINE_JUDGE |
| 89 | + freopen("error.txt", "w", stderr); |
| 90 | +#endif |
| 91 | + IOS; |
| 92 | + int t=1; |
| 93 | + // cin>>t; |
| 94 | + while(t--){ |
| 95 | + solve(); |
| 96 | + nl; |
| 97 | + } |
| 98 | + return 0; |
| 99 | +} |
| 100 | +// ---------- ROUGHCODE ---------- |
| 101 | +/* |
| 102 | +*/ |
| 103 | +// ---------- END ---------- |
| 104 | + |
0 commit comments