Why it is TL(time limit)???

Revision en2, by AsadulloAbduev, 2024-01-16 21:32:06

In this problem limit for N is 1e5, but in 4th test says "time limit exceeded". Why? really 1 second isn't 1e8? This is my code:

#include <bits\stdc++.h>
#define vector vector
#define pb push_back
#define ll long long
#define ull unsigned long long
#define ld double
#define str string
#define yes cout << "YES"
#define no cout << "NO"

using namespace std;

ll mod = 1e9 + 7, MAX = 1e18, MIN = -1e18;
ld pi = 3.141592;

void solve()
{
    ll n, i;
    cin >> n;
    str s, x = "", ans = " ", y = "";
    cin >> s;
    s = '.' + s;
    for (i = 1; i <= n; i++){
        x += s[i];
        y = s[i] + y;
        ans = min(ans, x + y);
    }
    cout << ans;
} 

main()
{
///    setlocale(LC_ALL, "UTF-8");
///    freopen ("input.txt", "r", stdin);
///    freopen ("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    cin >> t;
    while (t --> 0){
        solve();
        cout << '\n';
    }
}

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English AsadulloAbduev 2024-01-16 21:32:06 23 Tiny change: 'test says TL. Why? rea' -> 'test says "time limit exceeded". Why? rea' (published)
en1 English AsadulloAbduev 2024-01-16 17:28:52 1092 Initial revision (saved to drafts)