Submission #68112018


Source Code Expand

// Ohh Boy, Here We Go Again
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define ll long long
#define ld long double
#define ull uint_fast64_t
#define all(v) v.begin(),v.end()
#define f(_,n) for(ll _ = 0; _ < n; _++)
#define vi vector<ll>
#define ipa(arr) for(ll _ = 0; _ < sizeof(arr)/sizeof(arr[0]); _++) cin>>arr[_];
#define ipv(arr) for(ll _ = 0; _ < (int) arr.size(); _++) cin>>arr[_];
#define line cout<<endl; 
#define mp map<ll,ll>
#define st set<ll> 
#define pii pair<ll,ll>
#define vv vector<vector<ll>>
#define vvpi vector<vector<pair<ll,ll>>>
#define vpi vector<pair<ll,ll>>
#define pb push_back
#define F first
#define S second
#define fr(_,k,n) for(ll _ = k; _ < n; _++)
#define fv(_,k,n) for(ll _ = n-1; _ >= k; _--)
#define nah  cout << "NO\n"; return;
#define naah cout << "-1\n"; return;
#define yeah cout << "YES\n"; return;

const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e16;

using namespace std;
//using namespace __gnu_pbds;

#ifndef ONLINE_JUDGE  
#define debug(x) cout << endl << #x<<" "; _print(x); 
#define debuga(x,a) cout << endl << #x <<" [ "; for(ll i=0 ; i <a; i++) { _print(x[i]); cout<<" "; } cout<<"]";
#else 
#define debug(x)  
#define debuga(x,a) 
#endif
template <class T> void _print(T t) {cout << t;}
template <class T, class V> void _print(pair <T, V> p) {cout << "{"; _print(p.first); cout << ","; _print(p.second); cout << "}";}
template <class T> void _print(vector <T> v) {cout << "[ "; for (T i : v) {_print(i); cout << " ";} cout << "]";}
template <class T> void _print(set <T> v) {cout << "[ "; for (T i : v) {_print(i); cout << " ";} cout << "]";}
template <class T>  void _print(multiset <T> v) {cout << "[ "; for (T i : v) {_print(i); cout << " ";} cout << "]";}
template <class T, class V> void _print(map <T, V> v) {cout << "[ "; for (auto i : v) {_print(i); cout << " ";} cout << "]";}

ll interact(ll a, ll b)
{
   cout << "? " << a << " " << b << endl;cout.flush();
   ll res = 0; cin >> res ; return res;
}
ll cdiv(ll a,ll b)
{
    return (a + b - 1) / b;
}

vector<int> spf;
void sieve(long long n)
{
    spf.assign(n+1,1);
    spf[0] = 0;
    for (int i = 2; i <= n; i++) {
        if (spf[i] == 1) { 
            for (int j = i; j <= n; j += i) {
                if (spf[j]== 1)
                    spf[j] = i;
            }
        }
    }
}

long long binpow(long long a, long long b, long long m = LONG_LONG_MAX) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            {   
                res = (res * a);
                if(res>=m) res = res%m+m;
            }

        a =(a * a);
        if(a>=m)  a=a%m+m;
        b >>= 1;
    }
    return res%m;
}

struct dsu {
    vector <int> root, sz;
    int n;
 
    dsu(int nn){
        n = nn;
        root.resize(n + 1);
        sz.resize(n + 1, 1);
        for (int i = 1; i <= n; i++) root[i] = i;
    }
 
    int find(int x){
        if (root[x] == x) return x;
        return root[x] = find(root[x]);
    }
 
    bool unite(int x, int y){
        x = find(x); y = find(y);
        if (x == y) return false;
 
        if (sz[y] > sz[x]) swap(x, y);
        sz[x] += sz[y];
        root[y] = x;
        return true;
    }
};

const long long N = 1e6+100;
vector<pair<ll,ll>> moves = {{0,1},{1,0},{0,-1},{-1,0}};


void solve() {
    ll n = 0,m = 0,k = 0,d = 0,x = 0,y = 0,z = 0; bool ok = false,flag = false; string s,s1,s2; vi v;
    cin>>n>>x>>y>>s;
    fr(i,x,n-y) cout<<s[i];

}

//Add Modulo.
int main() 
{
    auto begin = std::chrono::high_resolution_clock::now();
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    // freopen("in",  "r", stdin);
    // freopen("out", "w", stdout);
    
    ll t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++) 
    {
        //cout << "Case #" << i << ": ";
        solve();
    }
    auto end = std::chrono::high_resolution_clock::now();
    auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin);

    #ifndef ONLINE_JUDGE  
    cout << "\nTime measured: " << elapsed.count() * 1e-9 << " seconds.\n"; 
    #else 
    #endif

    return 0;
}

Submission Info

Submission Time
Task A - A Substring
User krishbansal333
Language C++ 20 (gcc 12.2)
Score 100
Code Size 4254 Byte
Status AC
Exec Time 1 ms
Memory 3620 KiB

Compile Error

Main.cpp: In function ‘void solve()’:
Main.cpp:123:14: warning: unused variable ‘m’ [-Wunused-variable]
  123 |     ll n = 0,m = 0,k = 0,d = 0,x = 0,y = 0,z = 0; bool ok = false,flag = false; string s,s1,s2; vi v;
      |              ^
Main.cpp:123:20: warning: unused variable ‘k’ [-Wunused-variable]
  123 |     ll n = 0,m = 0,k = 0,d = 0,x = 0,y = 0,z = 0; bool ok = false,flag = false; string s,s1,s2; vi v;
      |                    ^
Main.cpp:123:26: warning: unused variable ‘d’ [-Wunused-variable]
  123 |     ll n = 0,m = 0,k = 0,d = 0,x = 0,y = 0,z = 0; bool ok = false,flag = false; string s,s1,s2; vi v;
      |                          ^
Main.cpp:123:44: warning: unused variable ‘z’ [-Wunused-variable]
  123 |     ll n = 0,m = 0,k = 0,d = 0,x = 0,y = 0,z = 0; bool ok = false,flag = false; string s,s1,s2; vi v;
      |                                            ^
Main.cpp:123:56: warning: unused variable ‘ok’ [-Wunused-variable]
  123 |     ll n = 0,m = 0,k = 0,d = 0,x = 0,y = 0,z = 0; bool ok = false,flag = false; string s,s1,s2; vi v;
      |                                                        ^~
Main.cpp:123:67: warning: unused variable ‘flag’ [-Wunused-variable]
  123 |     ll n = 0,m = 0,k = 0,d = 0,x = 0,y = 0,z = 0; bool ok = false,flag = false; string s,s1,s2; vi v;
      |                                                                   ^~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 10
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3492 KiB
00_sample_01.txt AC 1 ms 3448 KiB
00_sample_02.txt AC 1 ms 3492 KiB
01_random_03.txt AC 1 ms 3556 KiB
01_random_04.txt AC 1 ms 3484 KiB
01_random_05.txt AC 1 ms 3552 KiB
01_random_06.txt AC 1 ms 3456 KiB
01_random_07.txt AC 1 ms 3496 KiB
01_random_08.txt AC 1 ms 3620 KiB
01_random_09.txt AC 1 ms 3496 KiB