제출 #116368

#제출 시각아이디문제언어결과실행 시간메모리
116368zubec자동 인형 (IOI18_doll)C++14
0 / 100
1 ms204 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; const int N = 200100; int dir[N*4], n, sz; pair<int, int> pr[N]; void add(int v, int l, int r, int x){ if (l == r){ //cout << "kek " << v << ' ' << v/2-sz/2+1 << ' ' << x << endl; if (v % 2 == 0) pr[v/2-sz/2+1].first = x; else pr[v/2-sz/2+1].second = x; return; } int mid = (l+r)>>1; if (dir[v] == 0) add(v+v, l, mid, x); else add(v+v+1, mid+1, r, x); dir[v] ^= 1; } void create_circuit(int M, std::vector<int> A) { n = A.size(); sz = 1; while(sz < n) sz += sz; for (int i = 2; i <= n; i++){ add(1, 1, sz, A[i-1]); } for (int i = n+1; i < sz; i++){ add(1, 1, sz, -1); } add(1, 1, sz, 0); vector <int> C, X, Y; C.push_back(1); for (int i = 1; i <= M; i++) C.push_back(-1); for (int i = 1; i <= sz/2-1; i++){ X.push_back(-(i+i)); Y.push_back(-(i+i+1)); } int kol = 0; for (int i = 1; i <= sz/2; i++){ X.push_back(pr[i].first); Y.push_back(pr[i].second); } answer(C, X, Y); } /** 4 4 1 2 1 3 */

컴파일 시 표준 에러 (stderr) 메시지

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:46:9: warning: unused variable 'kol' [-Wunused-variable]
   46 |     int kol = 0;
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...