Submission #714799

#TimeUsernameProblemLanguageResultExecution timeMemory
714799aykhnBoarding Passes (BOI22_passes)C++14
5 / 100
3 ms480 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define OPT ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define pii pair<int,int> #define pll pair<ll,ll> #define endl "\n" #define all(v) v.begin(), v.end() #define mpr make_pair #define pb push_back #define ts to_string #define fi first #define se second #define inf 0x3F3F3F3F #define bpc __builtin_popcount #define print(v) for(int i = 0; i < v.size(); i++) \ cout << v[i] << " "; \ cout<<endl; /* int ternarySearch(int l, int r, int key, int ar[]) { if (r >= l) { int mid1 = l + (r - l) / 3; int mid2 = r - (r - l) / 3; if (ar[mid1] == key) { return mid1; } if (ar[mid2] == key) { return mid2; } if (key < ar[mid1]) { return ternarySearch(l, mid1 - 1, key, ar); } else if (key > ar[mid2]) { return ternarySearch(mid2 + 1, r, key, ar); } else { return ternarySearch(mid1 + 1, mid2 - 1, key, ar); } } return -1; } */ struct DSU { vector<int> e; void init(int n) { e.assign(n, -1); } int get(int x) { if (e[x] < 0) return x; return e[x] = get(e[x]); } bool together(int a, int b) { return get(a) == get(b); } int s(int x) { return -e[get(x)]; } bool unite(int x, int y) { x = get(x); y = get(y); if (x == y) return false; if (e[x] > e[y]) swap(x, y); e[x] += e[y]; e[y] = x; return true; } }; int k; vector<int> key(27, -1); int main() { string s; cin >> s; ll n = s.length(); ll x = n/2; ll y = n - x; ll t1 = x, t2 = y; ll a = t1*(t1-1)/2; ll b = t2*(t2-1)/2; if ((a + b) % 2 == 0) cout << (a + b)/2 << endl; else cout << (a + b)/2 << ".5" << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...