답안 #908124

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
908124 2024-01-16T08:16:24 Z eltu0815 Broken Device 2 (JOI22_device2) C++17
40 / 100
494 ms 25004 KB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

namespace {
    
}

int Declare() {
    return 2000;
}

std::pair<std::vector<int>, std::vector<int> > Anna(long long A) {
    int l = 3, a = 0, b = 0, m = 0;
    
    ll cnt = 1;
    while(true) {
        ll sz = l/3;
        if(cnt + (sz + 1) * (sz + 1) * (2 * l - 4 * sz + 1) <= A) {
            cnt += (sz + 1) * (sz + 1) * (2 * l - 4 * sz + 1);
            ++l;
        }
        else break;
    }
    
    while(true) {
        ll sz = l/3;
        if(cnt + (sz + 1) * (2 * l - 4 * sz + 1) <= A) {
            cnt += (sz + 1) * (2 * l - 4 * sz + 1);
            ++a;
        }
        else break;
    }
    
    while(true) {
        ll sz = l/3;
        if(cnt + (2 * l - 4 * sz + 1) <= A) {
            cnt += 2 * l - 4 * sz + 1;
            ++b;
        }
        else break;
    }
    
    m = A - cnt;
    
    int sz = l/3;
    vector<int> s(l, 0);
    vector<int> t(l, 0);
    for(int i = 0; i < a; ++i) s[i] = t[sz - 1 - i] = 1;
    for(int i = 0; i < b; ++i) s[l - 1 - i] = t[l - sz + i] = 1;
    
    for(int i = 0; i < min(m, l - 2 * sz); ++i) s[sz + i] = 1;
    for(int i = 0; i < m - (l - 2 * sz); ++i) t[sz + i] = 1;
    
    return {s, t};
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

namespace {
    
}

long long Bruno(std::vector<int> u) {
    int l = u.size();
    int a = 0, b = 0, m = 0;
    
    for(int i = 0; i < l/6; ++i) a += u[i], b += u[l - 1 - i];
    for(int i = 0; i < l; ++i) m += u[i];
    
    l /= 2;
    
    ll ret = 1;
    for(int i = 3; i < l; ++i) {
        ll sz = i/3;
        ret += (sz + 1) * (sz + 1) * (2 * i - 4 * sz + 1);
    }
    
    for(int i = 0; i < a; ++i) {
        ll sz = l/3;
        ret += (sz + 1) * (2 * l - 4 * sz + 1);
    }
    
    for(int i = 0; i < b; ++i) {
        ll sz = l/3;
        ret += (2 * l - 4 * sz + 1);
    }
    
    m -= 2 * (a + b);
    
    ret += m;
    return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 792 KB Output is correct
2 Correct 10 ms 820 KB Output is correct
3 Correct 11 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 792 KB Output is correct
2 Correct 10 ms 820 KB Output is correct
3 Correct 11 ms 1108 KB Output is correct
4 Correct 37 ms 2424 KB Output is correct
5 Correct 37 ms 2460 KB Output is correct
6 Correct 39 ms 2360 KB Output is correct
7 Correct 36 ms 2708 KB Output is correct
8 Correct 37 ms 2368 KB Output is correct
9 Correct 43 ms 2620 KB Output is correct
10 Correct 43 ms 2716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 792 KB Output is correct
2 Correct 10 ms 820 KB Output is correct
3 Correct 11 ms 1108 KB Output is correct
4 Correct 37 ms 2424 KB Output is correct
5 Correct 37 ms 2460 KB Output is correct
6 Correct 39 ms 2360 KB Output is correct
7 Correct 36 ms 2708 KB Output is correct
8 Correct 37 ms 2368 KB Output is correct
9 Correct 43 ms 2620 KB Output is correct
10 Correct 43 ms 2716 KB Output is correct
11 Correct 46 ms 2868 KB Output is correct
12 Correct 45 ms 2780 KB Output is correct
13 Correct 45 ms 3040 KB Output is correct
14 Correct 45 ms 2716 KB Output is correct
15 Correct 47 ms 2912 KB Output is correct
16 Correct 59 ms 3444 KB Output is correct
17 Correct 54 ms 3200 KB Output is correct
18 Correct 35 ms 2424 KB Output is correct
19 Correct 39 ms 2360 KB Output is correct
20 Correct 35 ms 2268 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 792 KB Output is correct
2 Correct 10 ms 820 KB Output is correct
3 Correct 11 ms 1108 KB Output is correct
4 Correct 37 ms 2424 KB Output is correct
5 Correct 37 ms 2460 KB Output is correct
6 Correct 39 ms 2360 KB Output is correct
7 Correct 36 ms 2708 KB Output is correct
8 Correct 37 ms 2368 KB Output is correct
9 Correct 43 ms 2620 KB Output is correct
10 Correct 43 ms 2716 KB Output is correct
11 Correct 46 ms 2868 KB Output is correct
12 Correct 45 ms 2780 KB Output is correct
13 Correct 45 ms 3040 KB Output is correct
14 Correct 45 ms 2716 KB Output is correct
15 Correct 47 ms 2912 KB Output is correct
16 Correct 59 ms 3444 KB Output is correct
17 Correct 54 ms 3200 KB Output is correct
18 Correct 35 ms 2424 KB Output is correct
19 Correct 39 ms 2360 KB Output is correct
20 Correct 35 ms 2268 KB Output is correct
21 Correct 71 ms 4520 KB Output is correct
22 Correct 75 ms 4776 KB Output is correct
23 Correct 73 ms 4384 KB Output is correct
24 Correct 75 ms 4380 KB Output is correct
25 Correct 81 ms 4296 KB Output is correct
26 Correct 89 ms 5032 KB Output is correct
27 Correct 89 ms 4964 KB Output is correct
28 Correct 63 ms 3392 KB Output is correct
29 Correct 56 ms 3400 KB Output is correct
30 Correct 61 ms 3692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 792 KB Output is correct
2 Correct 10 ms 820 KB Output is correct
3 Correct 11 ms 1108 KB Output is correct
4 Correct 37 ms 2424 KB Output is correct
5 Correct 37 ms 2460 KB Output is correct
6 Correct 39 ms 2360 KB Output is correct
7 Correct 36 ms 2708 KB Output is correct
8 Correct 37 ms 2368 KB Output is correct
9 Correct 43 ms 2620 KB Output is correct
10 Correct 43 ms 2716 KB Output is correct
11 Correct 46 ms 2868 KB Output is correct
12 Correct 45 ms 2780 KB Output is correct
13 Correct 45 ms 3040 KB Output is correct
14 Correct 45 ms 2716 KB Output is correct
15 Correct 47 ms 2912 KB Output is correct
16 Correct 59 ms 3444 KB Output is correct
17 Correct 54 ms 3200 KB Output is correct
18 Correct 35 ms 2424 KB Output is correct
19 Correct 39 ms 2360 KB Output is correct
20 Correct 35 ms 2268 KB Output is correct
21 Correct 71 ms 4520 KB Output is correct
22 Correct 75 ms 4776 KB Output is correct
23 Correct 73 ms 4384 KB Output is correct
24 Correct 75 ms 4380 KB Output is correct
25 Correct 81 ms 4296 KB Output is correct
26 Correct 89 ms 5032 KB Output is correct
27 Correct 89 ms 4964 KB Output is correct
28 Correct 63 ms 3392 KB Output is correct
29 Correct 56 ms 3400 KB Output is correct
30 Correct 61 ms 3692 KB Output is correct
31 Correct 425 ms 20408 KB Output is correct
32 Correct 384 ms 20380 KB Output is correct
33 Correct 387 ms 20416 KB Output is correct
34 Correct 420 ms 20524 KB Output is correct
35 Correct 385 ms 20148 KB Output is correct
36 Correct 494 ms 24988 KB Output is correct
37 Correct 473 ms 25004 KB Output is correct
38 Correct 290 ms 15544 KB Output is correct
39 Correct 301 ms 15476 KB Output is correct
40 Correct 293 ms 15700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1824 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -