Submission #954872

# Submission time Handle Problem Language Result Execution time Memory
954872 2024-03-28T18:29:01 Z alo_54 Broken Device (JOI17_broken_device) C++14
0 / 100
2 ms 1212 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++ )
  {
    Set(i, num[i] );
  }

  int wrongPos = P[0];

  if (wrongPos < 120)
  {
    char r = num[wrongPos];

    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++)
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 796 KB Wrong Answer [3]
2 Incorrect 0 ms 796 KB Wrong Answer [3]
3 Incorrect 0 ms 784 KB Wrong Answer [3]
4 Incorrect 0 ms 792 KB Wrong Answer [3]
5 Incorrect 0 ms 796 KB Wrong Answer [3]
6 Incorrect 0 ms 776 KB Wrong Answer [3]
7 Incorrect 0 ms 784 KB Wrong Answer [3]
8 Incorrect 1 ms 784 KB Wrong Answer [3]
9 Incorrect 1 ms 784 KB Wrong Answer [3]
10 Incorrect 0 ms 792 KB Wrong Answer [3]
11 Incorrect 1 ms 1212 KB Wrong Answer [3]
12 Incorrect 1 ms 784 KB Wrong Answer [3]
13 Incorrect 0 ms 796 KB Wrong Answer [3]
14 Incorrect 0 ms 792 KB Wrong Answer [3]
15 Incorrect 1 ms 796 KB Wrong Answer [3]
16 Incorrect 0 ms 788 KB Wrong Answer [3]
17 Incorrect 1 ms 792 KB Wrong Answer [3]
18 Incorrect 0 ms 796 KB Wrong Answer [3]
19 Incorrect 0 ms 780 KB Wrong Answer [3]
20 Incorrect 0 ms 796 KB Wrong Answer [3]
21 Incorrect 1 ms 792 KB Wrong Answer [3]
22 Incorrect 0 ms 796 KB Wrong Answer [3]
23 Incorrect 0 ms 800 KB Wrong Answer [3]
24 Incorrect 0 ms 784 KB Wrong Answer [3]
25 Incorrect 2 ms 784 KB Wrong Answer [3]
26 Incorrect 0 ms 784 KB Wrong Answer [3]
27 Incorrect 1 ms 796 KB Wrong Answer [3]
28 Incorrect 0 ms 784 KB Wrong Answer [3]
29 Incorrect 0 ms 796 KB Wrong Answer [3]
30 Incorrect 1 ms 796 KB Wrong Answer [3]
31 Incorrect 0 ms 776 KB Wrong Answer [3]
32 Incorrect 1 ms 796 KB Wrong Answer [3]
33 Incorrect 1 ms 796 KB Wrong Answer [3]
34 Incorrect 0 ms 792 KB Wrong Answer [3]
35 Incorrect 1 ms 796 KB Wrong Answer [3]
36 Incorrect 0 ms 780 KB Wrong Answer [3]
37 Incorrect 0 ms 796 KB Wrong Answer [3]
38 Incorrect 1 ms 784 KB Wrong Answer [3]
39 Incorrect 0 ms 796 KB Wrong Answer [3]
40 Incorrect 0 ms 776 KB Wrong Answer [3]