| Task: | Lukujono |
| Sender: | Lieska |
| Submission time: | 2025-11-28 20:06:46 +0200 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | TIME LIMIT EXCEEDED | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | TIME LIMIT EXCEEDED | -- | details |
| #2 | TIME LIMIT EXCEEDED | -- | details |
| #3 | ACCEPTED | 0.00 s | details |
Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void test(){
ll x;
cin >> x;
if (x%3==2) cout << "-1\n";
else{
int cnt=1;
while (x != 1){
cnt++;
if (x%3==0) x = x/3;
else x = 2*x+1;
}
cout << cnt << "\n";
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int tt;
cin >> tt;
while (tt--) test();
}Test details
Test 1
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 1000 1 2 3 4 ... |
| correct output |
|---|
| 1 -1 2 4 -1 ... |
| user output |
|---|
| (empty) |
Test 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 1000 152435 165584 587562 428318 ... |
| correct output |
|---|
| -1 -1 -1 -1 -1 ... |
| user output |
|---|
| (empty) |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 1000 235119 235120 235144 236196 ... |
| correct output |
|---|
| 27 27 27 14 27 ... |
| user output |
|---|
| 27 27 27 14 27 ... |
