/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 3ms 500.0 KiB
#3 Accepted 3ms 576.0 KiB

Code

#include <bits/stdc++.h>
#include <iostream>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set1;
typedef tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set2;
typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set_s;
typedef tree<pair<int, int>, null_type, less_equal<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set_s2;
typedef long long int ll;
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
const int N = 1200300;
#define pi 2 * acos(0.0)
#define vll vector<ll>
#define pq_ priority_queue
#define pq_min <int,vector<int>,greater<int>>
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define pb push_back
#define sp ' '
#define sz(n) (int)n.size()
#define all(n) n.begin(), n.end()
#define rall(n) n.rbegin(), n.rend()
#define YES cout << "YES\n";
#define yes cout << "yes\n";
#define NO cout << "NO\n";
#define no cout << "no\n";
#define bye return 0;
#define ss second;
#define ff first;
const double eps = 1e-9;
const int MAX = 1e5;
const int lim = 1e6;
bool odd(ll num) { return ((num & 1) == 1); }
bool even(ll num) { return ((num & 1) == 0); }
bool isEqual(double a, double b) { return abs(a - b) < eps; }
bool isGreater(double a, double b) { return a >= b + eps; }
bool isGreaterEqual(double a, double b) { return a > b - eps; }
#define tc     \
    int tt;    \
    cin >> tt; \
    while (tt--)
#define mset(n, v) memset(n, v, sizeof(n))
#define chk(n) for (auto it : n)
#define ff1(i, n) for (int i = 1; i <= n; i++)
#define lcm(a, b) (((a) * (b)) / __gcd(a, b))
int dx[8] = {1, -1, 0, 0, 1, -1, -1, 1};
int dy[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll mn(ll x, ll y)
{
    if (x < y)
        return x;
    else
        return y;
}
ll maxx(ll x, ll y)
{
    if (x > y)
        return x;
    else
        return y;
}std::vector<int> bin(int n) {
    std::vector<int> binary;
    
    while (n > 0) {
        binary.push_back(n % 2);
        n /= 2;
    }
 
    // Reverse the vector to get the binary representation in correct order
    std::reverse(binary.begin(), binary.end());
    
    return binary;
}
 
int ispal(int n)
{
 
    vi v = bin(n);
    int f = 0;
    for (int i = 0, j = v.size() - 1; i < v.size() / 2; i++, j--)
    {
        if (v[i] != v[j])
            f = 1;
    }
    if (!f)
        return 1;
    return 0;
}
 
ll POW(ll a, ll b)
{
    if (!b)
        return 1;
    ll r = POW(a, b / 2);
    if (b % 2)
        return r * r * a;
    else
        return r * r;
}
void pri(vi v)
{
    for (auto it : v)
        cout << it << ' ';
    cout << endl;
}
void pro(vll v)
{
    for (auto it : v)
        cout << it << ' ';
    cout << endl;
}
int mex(vi v, int l, int r)
{
    vi a;
    for (int i = l; i <= r; i++)
    {
        a.pb(v[i]);
    }
    sort(all(a));
    for (int i = 0, j = 1; i < a.size(); i++)
    {
        if (a[i] == j)
        {
            j++;
        }
        else
        {
            return j;
        }
    }
    return a.back() + 1;
}
vector<int> cps(const vector<int> &arr)
{
    int n = arr.size();
    vector<int> prefixSum(n);
 
    if (n > 0)
    {
        prefixSum[0] = arr[0];
        for (int i = 1; i < n; ++i)
        {
            prefixSum[i] = prefixSum[i - 1] + arr[i];
        }
    }
 
    return prefixSum;
}
 
 
 
bool comp(pair<int, int>x, pair<int, int>y)
{
    if (x.second > y.second)
        return true;
    else if (x.second == y.second)
    {
        if (x.first > y.first)
            return true;
        else
            return false;
    }
    else
        return false;
}
bool comp1(pair<int, pair<int,int>>x, pair<int, pair<int,int>>y)
{
    if (x.first > y.first)
        return true;
    else if (x.first == y.first)
    {
        if (x.second.second < y.second.second)
            return true;
        else
            return false;
    }
    else
        return false;
}
bool comp2(pair<int, pair<int,int>>x, pair<int, pair<int,int>>y)
{
    if (x.second.first > y.second.first)
        return true;
    else if (x.second.first == y.second.first)
    {
        if (x.second.second < y.second.second)
            return true;
        else
            return false;
    }
    else
        return false;
}
ll PoW(ll base, ll exponent) {
    ll result = 1;
    for (int i = 0; i < exponent; ++i) {
        result = (result * base)%10;;
    }
    return result;
}
 
bool isp(ll num) {
    ll om = num;
    ll rm = 0;
    while(num>0) {
        ll digit = num % 10;
        rm = rm * 10 + digit;
        num /= 10;
    }
    return om == rm;
}
string lcs(const std::vector<std::string>& strs) {
    std::vector<std::string::const_reverse_iterator> backs;
    std::string s;  
    if (strs.size() == 0) return "";
    if (strs.size() == 1) return strs[0]; 
    for (auto& str : strs) backs.push_back(str.crbegin()); 
    while (backs[0] != strs[0].crend()) {
        char ch = *backs[0]++;
        for (std::size_t i = 1; i<strs.size(); i++) {
            if (backs[i] == strs[i].crend()) goto done;
            if (*backs[i] != ch) goto done;
            backs[i]++;
        }
        s.push_back(ch);
    }  
done:
    reverse(s.begin(), s.end());
    return s;
}
bool leap(int year) {
    return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
}
bool isd(string s,ll d , ll y)
{
    if(d==32) return 0;
    if(s=="April"|| s=="June"|| s=="September"|| s=="November")
    {
        if(d==31) return 0;
        return 1;
    }
    if(d>28 && s=="February")
    {
         if(d==29 && leap(y))
         {
            return 1;
         }  
         return 0; 
    }
    return 1;
}
vll pref(vll v)
{
    vll pr;
    pr.pb(v.front());
    for(int i=1;i<v.size();i++)
    {
        pr.pb(v[i]+pr[i-1]);
    }
    return pr;
}
ll cxor(vi v, ll l,ll r)
{
    ll xo=v[l];
    for(int i=l+1;i<=r;i++)
    {
        xo^=v[i];
    }
    return xo;
}
#define seea(a,x,y) for(int i=x;i<y;i++){cin>>a[i];}
#define seev(v,n) for(int i=0;i<n;i++){int x; cin>>x; v.push_back(x);}
#define sees(s,n) for(int i=0;i<n;i++){int x; cin>>x; s.insert(x);}
bool is(int num, int pos) {
    // Create a mask with only the i'th bit set
    int mask = 1 << pos;

    // Perform bitwise AND operation to isolate the i'th bit
    int result = num & mask;

    // Check if the result is non-zero (bit is set)
    return result != 0;
}

// By Nitin Patel
// Function to merge two sorted subarrays of a given array
void merge(long long start, long long end,
           vector<long long>& prefix)
{
    long long n = end - start + 1;
    long long mid = (start + end) / 2;
    vector<long long> temp(n, 0);
    long long i = start;
    long long j = mid + 1;
    long long k = 0;

    // Merge the two subarrays in sorted order
    while (i <= mid and j <= end) {
        if (prefix[i] <= prefix[j]) {
            temp[k++] = prefix[i++];
        }
        else {
            temp[k++] = prefix[j++];
        }
    }

    // Copy the remaining elements of the left subarray, if
    // any
    while (i <= mid) {
        temp[k++] = prefix[i++];
    }

    // Copy the remaining elements of the right subarray, if
    // any
    while (j <= end) {
        temp[k++] = prefix[j++];
    }

    // Copy the merged subarray back to the original array
    for (int t = start; t <= end; t++) {
        prefix[t] = temp[t - start];
    }
}


bool isvo(char x){
    if(x=='a' || x=='e'||x=='i'|| x=='o'|| x=='u') return 1;
    return 0;
}
bool is_prime(ll x){
    for(ll i=2;i*i<=x;i++){
        if(x%i==0){
            return 0;
        }
    }    
    return 1;
}

using namespace __gnu_pbds;

typedef long long ll;
template <class type1>
using ordered_multiset = tree<type1, null_type, less_equal<type1>, rb_tree_tag, tree_order_statistics_node_update>;
template <class type1>
using ordered_multiset = tree<type1, null_type, less_equal<type1>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
template <class type1>
using ordered_multiset = tree<type1, null_type, less_equal<type1>, rb_tree_tag, tree_order_statistics_node_update>;

int main(){
    
    tc{
        string s;
        cin>>s;
        cout<<s.front()<<endl;
    }
}
    

Information

Submit By
Type
Submission
Problem
P1080 String Algorithm
Contest
Bangladesh 2.0
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-16 17:09:54
Judged At
2024-11-11 03:12:29
Judged By
Score
100
Total Time
3ms
Peak Memory
576.0 KiB