/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Time Exceeded ≥2071ms ≥328.0 KiB
#3 Time Exceeded ≥2008ms ≥332.0 KiB

Code

#include<bits/stdc++.h>
#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ll long long int
using namespace std;

void solution();

int main() {
    faster
    int t = 1;
    cin >> t;
    while (t--) {
        solution();
    }
}

void solution() {
    int x, y;
    cin >> x >> y;
    int op = 0;
    if(x==y)
        cout << 0 << endl;
    else if(y%2==0){
        while (x!=y) {
        x=x*2;
        op++;
       }
       cout << op << endl;
    }
    else{
        cout << y/2 << endl;

    }
}

Information

Submit By
Type
Submission
Problem
P1044 Add or multiple
Contest
TLE_Headquarters - round #1
Language
C++17 (G++ 13.2.0)
Submit At
2024-03-27 17:18:42
Judged At
2024-11-11 03:37:39
Judged By
Score
20
Total Time
≥2071ms
Peak Memory
≥540.0 KiB