답안 #954877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
954877 2024-03-28T18:31:52 Z alo_54 Broken Device (JOI17_broken_device) C++14
0 / 100
33 ms 3256 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

string desc(long long X)
{
  string resp;
  while (X)
  {
    int mod = X % 2;

    if (mod == 1)
    {
        resp += "1";
    }else
    {
        resp += "0";
    }
    
    X /= 2;
  }

  while (resp.size() < 60)
  {
    resp += "0";
  }
  

  reverse(resp.begin(), resp.end());

  resp += resp;

  return resp;
  
}

void Anna( int N, long long X, int K, int P[] )
{
  string num = desc(X);

  for( int i = 0; i < 120; i++ )
  {
    int bit = num[i] - '0';
    Set(i, bit);
  }

  int wrongPos = P[0];

  if (wrongPos < 120)
  {
    int r = num[wrongPos] - '0';

    Set(120, r);
  }else
  {
    Set(120, 1);
  }
  

  for (int i = 121; i < N; i++)
  {
    Set(i, 1);
  }


}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

long long comp(string s)
{
    reverse(s.begin(), s.end());

    long long resp = 0;

    long long p2 = 1;

    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == '1')
        {
            resp += p2;
        }

        p2 *= 2;

    }
  
  return resp;
  
}

long long Bruno( int N, int A[] )
{
  
  string resp;

  for (int i = 0; i < 60; i++)
  {
    if (A[i] == A[i + 60])
    {
      resp += A[i];
    }else
    {
      resp += A[120];
    }
    
  }

  long long X = comp(resp);
  

  return X;
}

Compilation message

Bruno.cpp: In function 'long long int comp(std::string)':
Bruno.cpp:13:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for (int i = 0; i < s.size(); i++)
      |                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 25 ms 2768 KB Output isn't correct - L* = 0
2 Partially correct 25 ms 2748 KB Output isn't correct - L* = 0
3 Partially correct 24 ms 2756 KB Output isn't correct - L* = 0
4 Partially correct 24 ms 2732 KB Output isn't correct - L* = 0
5 Partially correct 26 ms 2768 KB Output isn't correct - L* = 0
6 Partially correct 25 ms 2636 KB Output isn't correct - L* = 0
7 Partially correct 26 ms 3008 KB Output isn't correct - L* = 0
8 Partially correct 24 ms 2760 KB Output isn't correct - L* = 0
9 Partially correct 24 ms 2768 KB Output isn't correct - L* = 0
10 Partially correct 25 ms 2768 KB Output isn't correct - L* = 0
11 Partially correct 27 ms 2752 KB Output isn't correct - L* = 0
12 Partially correct 29 ms 3256 KB Output isn't correct - L* = 0
13 Partially correct 24 ms 2772 KB Output isn't correct - L* = 0
14 Partially correct 24 ms 2956 KB Output isn't correct - L* = 0
15 Partially correct 26 ms 2836 KB Output isn't correct - L* = 0
16 Partially correct 26 ms 2868 KB Output isn't correct - L* = 0
17 Partially correct 24 ms 2752 KB Output isn't correct - L* = 0
18 Partially correct 25 ms 2756 KB Output isn't correct - L* = 0
19 Partially correct 25 ms 2728 KB Output isn't correct - L* = 0
20 Partially correct 24 ms 2856 KB Output isn't correct - L* = 0
21 Partially correct 24 ms 2732 KB Output isn't correct - L* = 0
22 Partially correct 26 ms 2756 KB Output isn't correct - L* = 0
23 Partially correct 33 ms 2756 KB Output isn't correct - L* = 0
24 Partially correct 24 ms 2760 KB Output isn't correct - L* = 0
25 Partially correct 25 ms 2672 KB Output isn't correct - L* = 0
26 Partially correct 26 ms 2756 KB Output isn't correct - L* = 0
27 Partially correct 24 ms 2708 KB Output isn't correct - L* = 0
28 Partially correct 24 ms 2760 KB Output isn't correct - L* = 0
29 Partially correct 25 ms 2752 KB Output isn't correct - L* = 0
30 Partially correct 24 ms 2760 KB Output isn't correct - L* = 0
31 Partially correct 27 ms 2848 KB Output isn't correct - L* = 0
32 Partially correct 27 ms 2664 KB Output isn't correct - L* = 0
33 Partially correct 26 ms 2752 KB Output isn't correct - L* = 0
34 Partially correct 33 ms 2832 KB Output isn't correct - L* = 0
35 Partially correct 24 ms 2756 KB Output isn't correct - L* = 0
36 Partially correct 26 ms 2824 KB Output isn't correct - L* = 0
37 Partially correct 25 ms 2760 KB Output isn't correct - L* = 0
38 Partially correct 25 ms 2756 KB Output isn't correct - L* = 0
39 Partially correct 25 ms 2812 KB Output isn't correct - L* = 0
40 Partially correct 25 ms 2676 KB Output isn't correct - L* = 0