Time Exceeded
Code
#include <bits/stdc++.h>
#define int long long
using namespace std;
/*
OBSERVATIONS:
*/
signed main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--)
{
int k;
cin >> k;
int as = 1;
int curr = 0;
bool a_turn = true;
bool is_a = true;
while (true)
{
if (a_turn)
{
a_turn = false;
curr += as;
as++;
if (curr >= k)
{
break;
}
}
else
{
curr++;
if (curr == k)
{
is_a = false;
break;
}
a_turn = 1;
}
}
if (is_a)
cout << 'a' << endl;
else
cout << 'b' << endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1223 C. Infinity Sequence
- Contest
- Happy New Year 2026
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2026-01-06 14:47:32
- Judged At
- 2026-01-06 14:47:32
- Judged By
- Score
- 20
- Total Time
- ≥1099ms
- Peak Memory
- ≥572.0 KiB