/ SeriousOJ /

Record Detail

System Error


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 536.0 KiB
#2 System Error terminate called after throwing an instance of 'std::out_of_range' what(): stoll 2ms 532.0 KiB
#3 System Error terminate called after throwing an instance of 'std::out_of_range' what(): stoll 2ms 532.0 KiB
#4 System Error terminate called after throwing an instance of 'std::out_of_range' what(): stoll 2ms 532.0 KiB
#5 System Error terminate called after throwing an instance of 'std::out_of_range' what(): stoll 2ms 532.0 KiB
#6 System Error terminate called after throwing an instance of 'std::out_of_range' what(): stoll 2ms 532.0 KiB
#7 System Error terminate called after throwing an instance of 'std::out_of_range' what(): stoll 2ms 532.0 KiB
#8 System Error terminate called after throwing an instance of 'std::out_of_range' what(): stoll 2ms 568.0 KiB
#9 System Error terminate called after throwing an instance of 'std::out_of_range' what(): stoll 2ms 564.0 KiB
#10 System Error terminate called after throwing an instance of 'std::out_of_range' what(): stoll 2ms 532.0 KiB
#11 System Error terminate called after throwing an instance of 'std::out_of_range' what(): stoll 2ms 532.0 KiB
#12 System Error terminate called after throwing an instance of 'std::out_of_range' what(): stoll 2ms 532.0 KiB
#13 System Error terminate called after throwing an instance of 'std::out_of_range' what(): stoll 2ms 532.0 KiB
#14 System Error terminate called after throwing an instance of 'std::out_of_range' what(): stoll 2ms 532.0 KiB
#15 System Error terminate called after throwing an instance of 'std::out_of_range' what(): stoll 2ms 532.0 KiB

Code

#include <bits/stdc++.h>

using namespace std;

#define db long long
#define ll long long
#define int ll
#define vi vector<int>
#define vs vector<string>
#define vpi vector<pair<int, int>>
#define vpd vector<pair<double, double>>
#define vps vector<pair<string, string>>
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
#define pp(x) pop_back(x)
#define fr(cont) for (auto &i : (cont))
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define mo(a, b) (((a) % (b)) + (b)) % (b)
#define endl '\n'


void solve()
{
  /*
    1. Think Greedy
    2. Think Brute Force
    3. Think solution in reverse order
    4. Think DP [ check constraints carefully ]
    5. Check base cases for DP and prove solution for Greedy
    6. Think Graph
  */ 
    int n,k;
    cin>> n >> k;
    vector<string>vc(n);
    vi ans;
    fr(vc)cin >> i;
    for(int i = 0;i <= n-(k+1);i++)
    {
        string s = "";
        for(int j = i;j <= i+k;j++)
            s += vc[j];
        ans.pb(stoll(s));
    }
    sort(rall(ans));
    cout << ans[0] << endl;
}   

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // auto st = clock();
    int t = 1;
    cin >> t;
    for(int i = 1;i <= t;i++)
    {
        // cout << "Case " << i << ": ";
        solve();
    }

    // cerr << 1.0*(clock()-st)/CLOCKS_PER_SEC << endl;
    return 0;
}
/*Problem_link

*/

Information

Submit By
Type
Submission
Problem
P1083 Number concatenation
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-16 18:24:08
Judged At
2024-08-16 18:24:08
Judged By
Score
5
Total Time
2ms
Peak Memory
568.0 KiB