Submission #1029429

# Submission time Handle Problem Language Result Execution time Memory
1029429 2024-07-20T20:56:15 Z vjudge1 CATS (NOI14_cats) C++17
0 / 25
45 ms 6224 KB
#include "bits/stdc++.h"
using namespace std;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    long long q, x, l, n;
    cin>>q;
    while(q--){
        cin>>x>>l>>n;
        long long Izquierda = 0;
        long long Derecha = l;
        long long Mejor = 0;
        while(1){
            long long Promedio = (Izquierda + Derecha) / 2;
            if(Promedio * 2 * n < l){
                Izquierda = Promedio + 1;
            } else {
                Derecha = Promedio - 1;
                Mejor = Promedio;
            }
            if(Izquierda >= Derecha + 1) break;
        }
        long long Respuesta = Mejor * 2 * n;
        if(Mejor % 2 == 1){
            x--;
            x %= 4;
            if(x == 0 or x == 3) cout<<Respuesta<<"\n";
            else cout<<Respuesta + 1<<"\n";
        } else {
            x--;
            x %= 8;
            if(x == 0 or x == 3 or x == 5 or x == 6) cout<<Respuesta<<"\n";
            else cout<<Respuesta + 1<<"\n";
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 6224 KB Output isn't correct
2 Halted 0 ms 0 KB -