답안 #1077177

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1077177 2024-08-27T02:34:02 Z veehj Broken Device (JOI17_broken_device) C++17
0 / 100
1 ms 1208 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (ll) a.size()
#define all(x) (x).begin(), (x).end()
stack<ll> st;
int pl, curr;

void findans(ll x){
  if(x%2) st.push(1);
  else st.push(0);
  x/=2;
  if(x!=0) findans(x);
}

void stop(ll till){
  while(pl!=till+1){
    Set(pl, 0);
    pl++;
  }
}

void Anna( int N, long long X, int K, int P[] ){
  curr=0, pl=0;
  st={};
  findans(X);
  if(st.size()%2) st.push(1);
  else st.push(0);
  while(pl!=N){
    if(curr==K){
      while(1){
        if(st.empty()){
          stop(N-1);
          return;
        }
        Set(pl, 1);
        pl++;
        Set(pl, st.top());
        pl++; st.pop();
        if(st.empty()){
          stop(N-1);
          return;
        }
        Set(pl, st.top());
        pl++; st.pop();
        if(st.empty()){
          stop(N-1);
          return;
        }
      }
    } else {
      if(pl==P[curr]){
        Set(pl, 0);
        pl++; curr++;
        continue;
      }
      while(1){
        if(pl+3>P[curr]){
          stop(P[curr]);
          curr++;
          break;
        }
        if(st.empty()){
          stop(N-1);
          return;
        }
        Set(pl, 1);
        pl++;
        Set(pl, st.top());
        pl++; st.pop();
        if(st.empty()){
          stop(N-1);
          return;
        }
        Set(pl, st.top());
        pl++; st.pop();
        if(st.empty()){
          stop(N-1);
          return;
        }
      }
    }
  }
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (ll) a.size()
#define all(x) (x).begin(), (x).end()
queue<int> q;
int ok=0;
ll ans=0;

long long Bruno( int N, int A[] ){
  q={};
  for(int i=0; i<N; i++){
    if(A[i]==1){
      i++;
      if(q.empty()) ok=A[i];
      else q.push(A[i]);
      i++;
      q.push(A[i]);
    }
  }
  while(!q.empty()){
    if(q.size()==1 && !ok) break;
    ans*=2;
    ans+=q.front();
    q.pop();
  }
  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 800 KB Wrong Answer [1]
2 Incorrect 1 ms 1208 KB Wrong Answer [1]
3 Incorrect 0 ms 812 KB Wrong Answer [1]
4 Incorrect 0 ms 812 KB Wrong Answer [1]
5 Incorrect 1 ms 796 KB Wrong Answer [1]
6 Incorrect 1 ms 812 KB Wrong Answer [1]
7 Incorrect 1 ms 812 KB Wrong Answer [1]
8 Incorrect 1 ms 812 KB Wrong Answer [1]
9 Incorrect 0 ms 1064 KB Wrong Answer [1]
10 Incorrect 0 ms 812 KB Wrong Answer [1]
11 Incorrect 1 ms 812 KB Wrong Answer [1]
12 Incorrect 1 ms 1208 KB Wrong Answer [1]
13 Incorrect 1 ms 812 KB Wrong Answer [1]
14 Incorrect 1 ms 804 KB Wrong Answer [1]
15 Incorrect 0 ms 800 KB Wrong Answer [1]
16 Incorrect 0 ms 800 KB Wrong Answer [1]
17 Incorrect 1 ms 808 KB Wrong Answer [1]
18 Incorrect 0 ms 800 KB Wrong Answer [1]
19 Incorrect 0 ms 800 KB Wrong Answer [1]
20 Incorrect 1 ms 800 KB Wrong Answer [1]
21 Incorrect 1 ms 812 KB Wrong Answer [1]
22 Incorrect 1 ms 808 KB Wrong Answer [1]
23 Incorrect 0 ms 812 KB Wrong Answer [1]
24 Incorrect 1 ms 808 KB Wrong Answer [1]
25 Incorrect 0 ms 800 KB Wrong Answer [1]
26 Incorrect 1 ms 804 KB Wrong Answer [1]
27 Incorrect 1 ms 808 KB Wrong Answer [1]
28 Incorrect 0 ms 808 KB Wrong Answer [1]
29 Incorrect 1 ms 812 KB Wrong Answer [1]
30 Incorrect 0 ms 800 KB Wrong Answer [1]
31 Incorrect 1 ms 812 KB Wrong Answer [1]
32 Incorrect 0 ms 812 KB Wrong Answer [1]
33 Incorrect 0 ms 816 KB Wrong Answer [1]
34 Incorrect 1 ms 808 KB Wrong Answer [1]
35 Incorrect 0 ms 796 KB Wrong Answer [1]
36 Incorrect 1 ms 812 KB Wrong Answer [1]
37 Incorrect 0 ms 800 KB Wrong Answer [1]
38 Incorrect 0 ms 796 KB Wrong Answer [1]
39 Incorrect 1 ms 800 KB Wrong Answer [1]
40 Incorrect 1 ms 812 KB Wrong Answer [1]