제출 #786149

#제출 시각아이디문제언어결과실행 시간메모리
786149khshg드문 곤충 (IOI22_insects)C++17
0 / 100
1 ms208 KiB
#include"insects.h" #include<bits/stdc++.h> using namespace std; int min_cardinality(int N) { set<int> alr; int pr; for(int j = 1; j < 100; ++j) { int cnt = 0; for(int i = 0; i < N; ++i) { if(!alr.insert(i).second) continue; move_inside(i); int ks = press_button(); if(ks == i) { ++cnt; continue; } alr.erase(i); move_outside(i); } if(j > 1 && cnt != pr) { return j - 1; } pr = cnt; } return -1; }

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

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:18:19: warning: 'pr' may be used uninitialized in this function [-Wmaybe-uninitialized]
   18 |   if(j > 1 && cnt != pr) {
      |               ~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...