Submission #875920

# Submission time Handle Problem Language Result Execution time Memory
875920 2023-11-20T18:44:19 Z danikoynov Broken Device 2 (JOI22_device2) C++17
0 / 100
67 ms 5132 KB
#include "Anna.h"
#include <utility>
#include <vector>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int Declare()
{
    return 200;
}

std::pair<std::vector<int>, std::vector<int> > Anna(long long A)
{
    vector < int > lf;
    vector < int > rf;
    while(A > 0)
    {
        rf.push_back(A % 2);
        rf.push_back(A % 2);
        rf.push_back(A % 2);
        A /= 2;
    }
    for (int i = 0; i < rf.size(); i ++)
    {
        if (i % 2 == 0)
            lf.push_back(1);
        else
            lf.push_back(0);
    }
    cout << "up" << endl;
    for (int i = 0; i < lf.size(); i ++)
        cout << lf[i] << " ";
    cout << endl;
    cout << "down" << endl;
    for (int i = 0; i < rf.size(); i ++)
        cout << rf[i] << " ";
    cout << endl;
    return make_pair(lf, rf);
}
#include "Bruno.h"
#include <utility>
#include <vector>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;


long long Bruno(std::vector<int> u)
{

    ll ans = 0, last = 0, bit = 0;
    ll pref = 0;
    /**for (int cur : u)
        cout << cur << " ";
    cout << endl;*/
    for (int i = 0; i < u.size(); i ++)
    {

        int val = pref + u[i];
        pref += u[i];
        val = val - (i + 1 - val);
        int ost = val % 3;
        if (ost < 0)
            ost += 3;
        ///cout << pref << " : " << val << " " << val % 3 << endl;
        if (ost <= 1)
        {

            val -= ost;
            if (last == -1e9)
                last = val / 3;
            else
            if (val / 3 > last)
            {
                last = val / 3;
                ans = ans + (1 << bit);
                bit ++;
            }
            else
            if (val / 3 < last)
            {
                last = val / 3;
                bit ++;
            }
        }
    }
    //cout << endl;
    //cout << ans << endl;
    return ans;
}

Compilation message

Anna.cpp: In function 'std::pair<std::vector<int>, std::vector<int> > Anna(long long int)':
Anna.cpp:25:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for (int i = 0; i < rf.size(); i ++)
      |                     ~~^~~~~~~~~~~
Anna.cpp:33:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for (int i = 0; i < lf.size(); i ++)
      |                     ~~^~~~~~~~~~~
Anna.cpp:37:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for (int i = 0; i < rf.size(); i ++)
      |                     ~~^~~~~~~~~~~

Bruno.cpp: In function 'long long int Bruno(std::vector<int>)':
Bruno.cpp:18:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for (int i = 0; i < u.size(); i ++)
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 780 KB Do not print anything to stdout
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 780 KB Do not print anything to stdout
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 780 KB Do not print anything to stdout
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 780 KB Do not print anything to stdout
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 780 KB Do not print anything to stdout
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 67 ms 5132 KB Do not print anything to stdout
2 Halted 0 ms 0 KB -