제출 #585503

#제출 시각아이디문제언어결과실행 시간메모리
585503LIF자동 인형 (IOI18_doll)C++14
0 / 100
1 ms340 KiB
#include "doll.h" void create_circuit(int M, std::vector<int> A) { int N = A.size(); std::vector<int> x,y; std::vector<int> c; int n = N; c[0] = 1; std::vector<int> node[100005]; for(int i=1; i<=n-1; i++) { int qq = A[i]; node[qq].push_back(A[i+1]); } int xx = A[n]; node[xx].push_back(0); int fir = 1 ;//that means the first case is 1 ,and we can create our plan. for(int i=1;i<=M;i++) //that means we deal with the sensor. { int sum = node[i].size(); int num = 0; if(sum == 1) { int kx = node[i][0]; c.push_back(kx); } else { sum+=1; int dd=1; int flag = 0; for(int j=1;j<=100;j++) { dd*=2; num = j; //that means we should create how many hiearachy if(dd >= sum) { flag = 1; break; } } } } answer(c,x,y); }

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

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:32:9: warning: variable 'flag' set but not used [-Wunused-but-set-variable]
   32 |     int flag = 0;
      |         ^~~~
doll.cpp:21:8: warning: variable 'num' set but not used [-Wunused-but-set-variable]
   21 |    int num = 0;
      |        ^~~
doll.cpp:17:7: warning: unused variable 'fir' [-Wunused-variable]
   17 |   int fir = 1 ;//that means the first case is 1 ,and we can create our plan.
      |       ^~~
#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...