# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1112469 | 2024-11-14T08:35:37 Z | thelegendary08 | 자동 인형 (IOI18_doll) | C++14 | 82 ms | 16056 KB |
#include "doll.h" #include<bits/stdc++.h> #define vi vector<int> #define pb push_back #define vvi vector<vector<int>> #define f0r(i,n) for(int i = 0; i<n; i++) #define vout(v) for(auto u : v)cout<<u<<' '; cout<<'\n'; using namespace std; void create_circuit(int M, std::vector<int> A) { vi v; v.pb(0); for(auto u : A)v.pb(u); v.pb(0); vvi nxt(M+1); f0r(i, v.size() - 1){ nxt[v[i]].pb(v[i+1]); } int curnum = 0; vi c(M+1); vi x; vi y; //f0r(t, M+1)cout<<nxt[t].size()<<' '; //cout<<'\n'; f0r(t, M+1){ /* if(nxt[i].size() == 1){ c[i] = nxt[i][0]; } else if(nxt[i].size() == 2){ c[i] = num; x.pb(nxt[i][0]); y.pb(nxt[i][1]); num--; } else if(nxt[i].size() == 3){ c[i] = num; x.pb(num-1); y.pb(num - 2); num--; x.pb(nxt[i][0]); y.pb(nxt[i][1]); num--; x.pb(c[i]); y.pb(nxt[i][2]); num--; } else if(nxt[i].size() == 4){ c[i] = num; x.pb(num-1); y.pb(num - 2); num--; x.pb(nxt[i][0]); y.pb(nxt[i][2]); num--; x.pb(nxt[i][1]); y.pb(nxt[i][3]); num--; } */ if(nxt[t].size() >= 2){ int mx = ceil(log2(nxt[t].size())); int bts = (1 << mx) - nxt[t].size(); int num = -1; int ptr = 0; c[t] = curnum - 1; f0r(i, mx){ f0r(j, (1 << i)){ if(i != mx - 1){ x.pb(curnum + num * 2); y.pb(curnum + num * 2 - 1); } else{ int ind1; int nind = j*2; ind1 = 0; for(int k = mx-1; k>=0; k--){ ind1 += (1 << (mx -1- k)) * (((1 << k) & nind) > 0); } //cout<<nind<<' '<<ind1<<'\n'; int nind2 = j*2 + 1; int ind2 = 0; for(int k = mx; k>=0; k--){ ind2 += (1 << (mx -1- k)) * (((1 << k) & nind2) > 0); } //cout<<nind2<<' '<<ind2<<'\n'; if(ind1 >= bts){ x.pb(nxt[t][ind1 - bts]); } else{ x.pb(curnum - 1); } if(ind2 >= bts){ y.pb(nxt[t][ind2 - bts]); } else{ y.pb(curnum - 1); } } num--; } } //cout<<bts<<'\n'; /* for(int i = (1 << (mx - 1)); i < (1 << mx) - 1; i++){ if(bts >= 2){ x[curnum + i - 1] = curnum-1; y[curnum + i-1] = curnum-1; bts -= 2; } else if(bts == 1){ x[curnum + i-1] = curnum-1; bts--; } } */ //y[y.size() - 1] = 0; curnum += num + 1; } else if(nxt[t].size() == 1){ c[t] = nxt[t][0]; } } //vout(c); //vout(x); //vout(y); answer(c,x,y); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 19 ms | 6600 KB | Output is correct |
3 | Correct | 18 ms | 5576 KB | Output is correct |
4 | Correct | 1 ms | 508 KB | Output is correct |
5 | Correct | 6 ms | 3920 KB | Output is correct |
6 | Correct | 26 ms | 8136 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 19 ms | 6600 KB | Output is correct |
3 | Correct | 18 ms | 5576 KB | Output is correct |
4 | Correct | 1 ms | 508 KB | Output is correct |
5 | Correct | 6 ms | 3920 KB | Output is correct |
6 | Correct | 26 ms | 8136 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 33 ms | 7888 KB | Output is correct |
9 | Correct | 47 ms | 10180 KB | Output is correct |
10 | Correct | 59 ms | 12224 KB | Output is correct |
11 | Correct | 2 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 336 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 19 ms | 6600 KB | Output is correct |
3 | Correct | 18 ms | 5576 KB | Output is correct |
4 | Correct | 1 ms | 508 KB | Output is correct |
5 | Correct | 6 ms | 3920 KB | Output is correct |
6 | Correct | 26 ms | 8136 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 33 ms | 7888 KB | Output is correct |
9 | Correct | 47 ms | 10180 KB | Output is correct |
10 | Correct | 59 ms | 12224 KB | Output is correct |
11 | Correct | 2 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 336 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 63 ms | 13096 KB | Output is correct |
15 | Correct | 38 ms | 7236 KB | Output is correct |
16 | Correct | 50 ms | 10728 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 1 ms | 336 KB | Output is correct |
19 | Correct | 1 ms | 504 KB | Output is correct |
20 | Correct | 61 ms | 11432 KB | Output is correct |
21 | Correct | 1 ms | 336 KB | Output is correct |
22 | Correct | 1 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 336 KB | Output is partially correct |
2 | Correct | 29 ms | 6308 KB | Output is correct |
3 | Partially correct | 46 ms | 8820 KB | Output is partially correct |
4 | Partially correct | 52 ms | 9844 KB | Output is partially correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 336 KB | Output is partially correct |
2 | Correct | 29 ms | 6308 KB | Output is correct |
3 | Partially correct | 46 ms | 8820 KB | Output is partially correct |
4 | Partially correct | 52 ms | 9844 KB | Output is partially correct |
5 | Partially correct | 73 ms | 14816 KB | Output is partially correct |
6 | Partially correct | 82 ms | 15844 KB | Output is partially correct |
7 | Partially correct | 71 ms | 14800 KB | Output is partially correct |
8 | Partially correct | 74 ms | 15696 KB | Output is partially correct |
9 | Partially correct | 53 ms | 10916 KB | Output is partially correct |
10 | Partially correct | 70 ms | 15684 KB | Output is partially correct |
11 | Partially correct | 74 ms | 16056 KB | Output is partially correct |
12 | Partially correct | 47 ms | 10764 KB | Output is partially correct |
13 | Partially correct | 50 ms | 8948 KB | Output is partially correct |
14 | Partially correct | 50 ms | 9544 KB | Output is partially correct |
15 | Partially correct | 44 ms | 8688 KB | Output is partially correct |
16 | Partially correct | 2 ms | 592 KB | Output is partially correct |
17 | Partially correct | 41 ms | 7664 KB | Output is partially correct |
18 | Partially correct | 42 ms | 8432 KB | Output is partially correct |
19 | Partially correct | 42 ms | 8176 KB | Output is partially correct |
20 | Partially correct | 65 ms | 12632 KB | Output is partially correct |
21 | Partially correct | 72 ms | 15032 KB | Output is partially correct |
22 | Partially correct | 50 ms | 10984 KB | Output is partially correct |