답안 #637186

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
637186 2022-08-31T21:39:49 Z stevancv 자동 인형 (IOI18_doll) C++14
12 / 100
124 ms 8188 KB
#include <bits/stdc++.h>
#include "doll.h"
#define ll long long
#define ld long double
#define sp ' '
#define en '\n'
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
using namespace std;
const int N = 2e5 + 2;
const int mod = 1e9 + 7;
int val[N];
int lc[2 * N], rc[2 * N], root, tsz, bound;
void Create(int &c, int l, int r) {
    if (r < bound) {c = root; return;}
    if (l == r) {c = -val[l]; return;}
    c = ++tsz;
    int mid = l + r >> 1;
    Create(lc[c], l, mid);
    Create(rc[c], mid + 1, r);
}
void create_circuit(int m, vector<int> a) {
    a.push_back(0);
    int n = a.size();
    int x = 1;
    while (x < n) x *= 2;
    vector<int> id(x);
    iota(id.begin(), id.end(), 0);
    sort(id.begin(), id.end(), [&] (int i, int j) {
        for (int b = 0; b < 20; b++) {
            int p = (1 << b) & i; int q = (1 << b) & j;
            if (p != q) return p < q;
        }
    });
    vector<pair<int, int>> v;
    for (int i = x - n; i < x; i++) v.push_back({id[i], i});
    sort(v.begin(), v.end());
    for (int i = 0; i < n; i++) val[v[i].second] = a[i];
    bound = x - n;
    Create(root, 0, x - 1);
    vector<int> c(m + 1, -1);
    vector<int> X, Y;
    for (int i = 1; i <= tsz; i++) {
        X.push_back(-lc[i]);
        Y.push_back(-rc[i]);
    }
    answer(c, X, Y);
}

Compilation message

doll.cpp: In function 'void Create(int&, int, int)':
doll.cpp:18:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   18 |     int mid = l + r >> 1;
      |               ~~^~~
doll.cpp: In lambda function:
doll.cpp:34:5: warning: control reaches end of non-void function [-Wreturn-type]
   34 |     });
      |     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 71 ms 6152 KB Output is correct
3 Correct 68 ms 5644 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 11 ms 1492 KB Output is correct
6 Correct 83 ms 8188 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 71 ms 6152 KB Output is correct
3 Correct 68 ms 5644 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 11 ms 1492 KB Output is correct
6 Correct 83 ms 8188 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Runtime error 124 ms 7904 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 71 ms 6152 KB Output is correct
3 Correct 68 ms 5644 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 11 ms 1492 KB Output is correct
6 Correct 83 ms 8188 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Runtime error 124 ms 7904 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 316 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 107 ms 7980 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 107 ms 7980 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -