답안 #551434

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
551434 2022-04-20T16:38:11 Z BalintR Broken Device 2 (JOI22_device2) C++17
13 / 100
565 ms 24272 KB
#include <bits/stdc++.h>
using namespace std;
#include "Anna.h"

namespace {
    typedef unsigned uint;
    typedef long long ll;
    typedef unsigned long long ull;
    typedef pair<int, int> pii;
    typedef pair<ll, ll> pll;
    typedef vector<int> vi;
    typedef vector<pii> vpii;
    typedef complex<double> cmplx;
    template <typename T> using minPq = priority_queue<T, vector<T>, greater<T>>;
#define boost() cin.sync_with_stdio(0); cin.tie(0)
#define ms(a, x) memset(a, x, sizeof(a))
#define pb push_back
#define fs first
#define sn second
#define ALL(v) (v).begin(), (v).end()
#define SZ(v) ((int) (v).size())
#define lbv(v, x) (lower_bound((v).begin(), (v).end(), x) - (v).begin())
#define ubv(v, x) (upper_bound((v).begin(), (v).end(), x) - (v).begin())
    template <typename T> inline void UNIQUE(vector<T> &v){sort(ALL(v)); v.resize(unique(ALL(v)) - v.begin());}
    const int INF = 0x3f3f3f3f;
    const ll LLINF = 0x3f3f3f3f3f3f3f3f;
    const double PI = acos(-1);
#define FR(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define dbg(x) {cout << #x << ' ' << x << endl;}
#define dbgArr(arr, n) {cout << #arr; FR(_i, n) cout << ' ' << arr[_i]; cout << endl;}

    const int MX = 3.9e6;
    const int MN = 2000;
}

int Declare(){
    return MN;
}

pair<vi, vi> Anna(ll input){
    ll x = input % MX;
    input /= MX;

    int len = 4, pop = -1;
    while(len < MN){
        int dif = len*2 - 7;
        if(x < dif){
            pop = 4 + x;
            break;
        }
        x -= dif;
        len++;
    }

    vi res1(len), res2(len);
    if(input & 1) res1[0] = res2[0] = 1, pop -= 2;
    if(input & 2) res1.back() = res2.back() = 1, pop -= 2;
    FOR(i, 1, len-1) if(pop) res1[i] = 1, pop--;
    FOR(i, 1, len-1) if(pop) res2[i] = 1, pop--;
    return {res1, res2};
}
#include <bits/stdc++.h>
using namespace std;
#include "Bruno.h"

namespace {
    typedef unsigned uint;
    typedef long long ll;
    typedef unsigned long long ull;
    typedef pair<int, int> pii;
    typedef pair<ll, ll> pll;
    typedef vector<int> vi;
    typedef vector<pii> vpii;
    typedef complex<double> cmplx;
    template <typename T> using minPq = priority_queue<T, vector<T>, greater<T>>;
#define boost() cin.sync_with_stdio(0); cin.tie(0)
#define ms(a, x) memset(a, x, sizeof(a))
#define pb push_back
#define fs first
#define sn second
#define ALL(v) (v).begin(), (v).end()
#define SZ(v) ((int) (v).size())
#define lbv(v, x) (lower_bound((v).begin(), (v).end(), x) - (v).begin())
#define ubv(v, x) (upper_bound((v).begin(), (v).end(), x) - (v).begin())
    template <typename T> inline void UNIQUE(vector<T> &v){sort(ALL(v)); v.resize(unique(ALL(v)) - v.begin());}
    const int INF = 0x3f3f3f3f;
    const ll LLINF = 0x3f3f3f3f3f3f3f3f;
    const double PI = acos(-1);
#define FR(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define dbg(x) {cout << #x << ' ' << x << endl;}
#define dbgArr(arr, n) {cout << #arr; FR(_i, n) cout << ' ' << arr[_i]; cout << endl;}

    const int MX = 3.9e6;
    const int MN = 2000;
}


ll Bruno(vi u){
    int len = 4;
    ll cnt = 0;
    while(len < SZ(u)/2){
        int dif = len*2 - 7;
        cnt += dif;
        len++;
    }

    int pop = 0;
    for(int a : u) pop += a;
    cnt += pop-4;

    ll res = cnt;
    if(u.front()) res += MX;
    if(u.back()) res += MX*2;
    cerr << res << endl;
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 516 KB Output is correct
2 Correct 20 ms 1008 KB Output is correct
3 Correct 27 ms 1240 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 516 KB Output is correct
2 Correct 20 ms 1008 KB Output is correct
3 Correct 27 ms 1240 KB Output is correct
4 Correct 505 ms 21372 KB Output is correct
5 Correct 486 ms 21212 KB Output is correct
6 Correct 512 ms 21472 KB Output is correct
7 Correct 506 ms 21000 KB Output is correct
8 Correct 546 ms 21616 KB Output is correct
9 Correct 123 ms 5664 KB Output is correct
10 Correct 129 ms 5656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 516 KB Output is correct
2 Correct 20 ms 1008 KB Output is correct
3 Correct 27 ms 1240 KB Output is correct
4 Correct 505 ms 21372 KB Output is correct
5 Correct 486 ms 21212 KB Output is correct
6 Correct 512 ms 21472 KB Output is correct
7 Correct 506 ms 21000 KB Output is correct
8 Correct 546 ms 21616 KB Output is correct
9 Correct 123 ms 5664 KB Output is correct
10 Correct 129 ms 5656 KB Output is correct
11 Correct 491 ms 20916 KB Output is correct
12 Correct 498 ms 20636 KB Output is correct
13 Correct 504 ms 20904 KB Output is correct
14 Correct 474 ms 20988 KB Output is correct
15 Correct 497 ms 20656 KB Output is correct
16 Correct 565 ms 24272 KB Output is correct
17 Correct 564 ms 24260 KB Output is correct
18 Correct 370 ms 15724 KB Output is correct
19 Correct 384 ms 15748 KB Output is correct
20 Correct 381 ms 15304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 516 KB Output is correct
2 Correct 20 ms 1008 KB Output is correct
3 Correct 27 ms 1240 KB Output is correct
4 Correct 505 ms 21372 KB Output is correct
5 Correct 486 ms 21212 KB Output is correct
6 Correct 512 ms 21472 KB Output is correct
7 Correct 506 ms 21000 KB Output is correct
8 Correct 546 ms 21616 KB Output is correct
9 Correct 123 ms 5664 KB Output is correct
10 Correct 129 ms 5656 KB Output is correct
11 Correct 491 ms 20916 KB Output is correct
12 Correct 498 ms 20636 KB Output is correct
13 Correct 504 ms 20904 KB Output is correct
14 Correct 474 ms 20988 KB Output is correct
15 Correct 497 ms 20656 KB Output is correct
16 Correct 565 ms 24272 KB Output is correct
17 Correct 564 ms 24260 KB Output is correct
18 Correct 370 ms 15724 KB Output is correct
19 Correct 384 ms 15748 KB Output is correct
20 Correct 381 ms 15304 KB Output is correct
21 Incorrect 513 ms 21792 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 516 KB Output is correct
2 Correct 20 ms 1008 KB Output is correct
3 Correct 27 ms 1240 KB Output is correct
4 Correct 505 ms 21372 KB Output is correct
5 Correct 486 ms 21212 KB Output is correct
6 Correct 512 ms 21472 KB Output is correct
7 Correct 506 ms 21000 KB Output is correct
8 Correct 546 ms 21616 KB Output is correct
9 Correct 123 ms 5664 KB Output is correct
10 Correct 129 ms 5656 KB Output is correct
11 Correct 491 ms 20916 KB Output is correct
12 Correct 498 ms 20636 KB Output is correct
13 Correct 504 ms 20904 KB Output is correct
14 Correct 474 ms 20988 KB Output is correct
15 Correct 497 ms 20656 KB Output is correct
16 Correct 565 ms 24272 KB Output is correct
17 Correct 564 ms 24260 KB Output is correct
18 Correct 370 ms 15724 KB Output is correct
19 Correct 384 ms 15748 KB Output is correct
20 Correct 381 ms 15304 KB Output is correct
21 Incorrect 513 ms 21792 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 519 ms 22200 KB Output isn't correct
2 Halted 0 ms 0 KB -