답안 #875923

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
875923 2023-11-20T18:45:24 Z danikoynov Broken Device 2 (JOI22_device2) C++17
컴파일 오류
0 ms 0 KB
#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 ++)
    {

        ll val = pref + u[i];
        pref += u[i];
        val = val - (i + 1 - val);
        ll 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 + ((ll)(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 'long long int Bruno(std::vector<int>)':
Anna.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 ++)
      |                     ~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccnnoG17.o: in function `main':
grader_anna.cpp:(.text.startup+0xd2): undefined reference to `Declare()'
/usr/bin/ld: grader_anna.cpp:(.text.startup+0x1d5): undefined reference to `Anna(long long)'
collect2: error: ld returned 1 exit status

/usr/bin/ld: /tmp/ccZfDlUR.o: in function `main':
grader_bruno.cpp:(.text.startup+0x3ab): undefined reference to `Bruno(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status