제출 #76025

#제출 시각아이디문제언어결과실행 시간메모리
76025idLeMechanical Doll (IOI18_doll)C++14
0 / 100
2 ms204 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; #define LL (nod << 1) #define RR (LL | 1) const int NMAX = 100010; int arb[8*NMAX], N; bool switches[8*NMAX], last; vector <int> X, Y, C; void dfs(int nod, int st, int dr, int trig){ if (st == dr){ if (last) C[trig] = 0; else C[trig] = -1; if (nod & 1) Y[nod/2] = trig; else X[nod/2] = trig; switches[nod] = !switches[nod]; return; } int mid = (st + dr) >> 1; if (switches[nod]) dfs(RR, mid+1, dr, trig); else dfs(LL, st, mid, trig); switches[nod] = !switches[nod]; } void build(int nod, int st, int dr){ if (st == dr){ X[nod/2] = Y[nod/2] = -1; //if (nod & 1) Y[nod/2] = st; //else X[nod/2] = st; //if (st == N) C[nod] = 0; //else C[nod] = -1; return; } int mid = (st + dr) >> 1; X[nod] = -LL; Y[nod] = -RR; build(LL, st, mid); build(RR, mid + 1, dr); } void create_circuit(int M, vector<int> A){ N = A.size(); C = vector<int>(M+1); X = vector<int>(N); Y = vector<int>(N); C[0] = -1; build(1, 1, N); for (int i=0; i<A.size(); i++){ if (i == A.size() - 1) last = 1; dfs(1, 1, N, A[i]); } X.erase(X.begin()); Y.erase(Y.begin()); //for (auto it: C) cout << it << " "; //cout << "\n"; //for (auto it: X) cout << it << " "; //cout << "\n"; //for (auto it: Y) cout << it << " "; //cout << "\n"; answer(C, X, Y); }

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

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:50:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |     for (int i=0; i<A.size(); i++){
      |                   ~^~~~~~~~~
doll.cpp:51:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |         if (i == A.size() - 1) last = 1;
      |             ~~^~~~~~~~~~~~~~~
#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...