답안 #1028425

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1028425 2024-07-19T20:21:28 Z AdamGS Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
31 ms 8784 KB
#include "Anna.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
void enc(vector<int>P) {
  vector<ll>ile(51);
  ile[0]=1;
  ile[1]=2;
  for(ll i=2; i<=50; ++i) ile[i]=ile[i-1]+ile[i-2];
  for(int i=0; i<P.size(); i+=50) {
    ll x=0;
    rep(j, 50) if(P[j]) x+=ile[50-j-1];
    rep(j, 35) if(x&(1ll<<(ll)j)) Send(1); else Send(0);
  }
}
void Anna(int n, vector<char>T) {
  vector<int>P(n);
  rep(i, n) if(T[i]=='X') {
    P[i]=1;
    for(int j=i+1; j<n; ++j) {
      if(T[j]=='Z') P[j]=1;
    }
    break;
  }
  while(P.size()%50!=0) P.pb(0);
  enc(P);
}
#include "Bruno.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
vector<int>dec(vector<int>P) {
  vector<int>T;
  vector<ll>ile(51);
  ile[0]=1;
  ile[1]=2;
  for(ll i=2; i<=50; ++i) ile[i]=ile[i-1]+ile[i-2];
  for(int i=0; i<P.size(); i+=35) {
    ll x=0;
    rep(j, 35) if(P[i+j]) x|=1ll<<(ll)j;
    rep(j, 50) {
      if(x>=ile[50-j-1]) {
        x-=ile[50-j-1];
        T.pb(1);
      } else T.pb(0);
    }
  }
  return T;
}
void Bruno(int n, int m, vector<int>P) {
  vector<int>T=dec(P);
  int x=-1;
  rep(i, n) {
    if(T[i]) {
      x=i;
      break;
    } else Remove(i);
  }
  if(x==-1) return;
  int lst=x;
  for(int i=x+1; i<n; ++i) if(T[i]) {
    for(int j=i-1; j>lst; --j) Remove(j);
    Remove(i);
    lst=i;
  }
  Remove(x);
  for(int i=lst+1; i<n; ++i) Remove(i);
}

Compilation message

Anna.cpp: In function 'void enc(std::vector<int>)':
Anna.cpp:15:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |   for(int i=0; i<P.size(); i+=50) {
      |                ~^~~~~~~~~

Bruno.cpp: In function 'std::vector<int> dec(std::vector<int>)':
Bruno.cpp:16:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |   for(int i=0; i<P.size(); i+=35) {
      |                ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 788 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 8784 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -