답안 #1029447

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1029447 2024-07-20T21:59:27 Z vjudge1 CATS (NOI14_cats) C++11
0 / 25
1500 ms 262144 KB
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
ll X,L,N,t;
int main(){
    scanf("%lld",&t);
    while(t--){
        scanf("%lld %lld %lld",&X,&L,&N);
        ll con=X;
        vector<pair<ll,ll>> S1(10000,{0,0});
        ll flip=0;
        while(con>0){
            ll T1=S1.back().F;
            ll aux=S1.back().S;
            if((flip-aux)%2==1){
                T1^=1;
            }
            S1.pop_back();
            //FLIP LAST BINARY BIT OF ALL NUMBERS IN S1
            flip++;
            if(T1>L){
                con--;
                if(con==0){
                    printf("%lld\n",T1);
                }
            }else{
                ll f1=T1+2*N;
                S1.push_back({f1,flip});
                S1.push_back({f1,flip});
            }
        }
    }
}

Compilation message

cats.cpp: In function 'int main()':
cats.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%lld",&t);
      |     ~~~~~^~~~~~~~~~~
cats.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%lld %lld %lld",&X,&L,&N);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 696 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 700 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 700 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1563 ms 9236 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 348 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 351 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -