제출 #668453

#제출 시각아이디문제언어결과실행 시간메모리
668453allin27x동굴 (IOI13_cave)C++14
0 / 100
2074 ms65536 KiB
#include <iostream> #include <vector> #include <unordered_set> #include <deque> #include "cave.h" using namespace std; int tryCombination(int S[]); void answer(int S[], int D[]); void exploreCave(int N){ int doors[N]={}; int perm[N] = {}; unordered_set<int> f; int tr[N] = {}; for (int s=0; s<N; s++){ int pos = 0; for (int i=0; i<N; i++){ if (f.count(i)) tr[i] = perm[i]; else tr[i]=0; } int r = tryCombination(tr); if (r==s) pos = 1; if (!pos) for (int i=0; i<N; i++){ if (f.count(i)) tr[i] = perm[i]; else tr[i]=1; } deque<int> av; for (int i=0; i<N; i++) if (!f.count(i)) av.push_back(i); int a = 0, b = av.size()-1; while (a!=b){ int m = (a+b)/2; int q = 0; for (auto it = av.begin(); q<=m; it++){ if (!f.count(*it)) tr[*it] = pos; q++; } r = tryCombination(tr); for (int i=0; i<av.size(); i++) cout<<av[i]; cout<<endl; if (r==s) { a = m+1; int q = 0; for (auto it = av.begin(); q<=m; it++){ if (!f.count(*it)) tr[*it] =! pos; q++; } for (int i=0; i<=m; i++) av.pop_front(); }else { int q = 0; for (auto it = av.begin(); q<=m; it++){ if (!f.count(*it)) tr[*it] = !pos; q++; } for (int i=b; i>m; i--) av.pop_back(); b =m; } } doors[av.front()] = s; perm[av.front()] = pos; f.insert(av.front()); tr[av.front()] = pos; } answer(perm,doors); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:38:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |             for (int i=0; i<av.size(); i++) cout<<av[i]; cout<<endl;
      |                           ~^~~~~~~~~~
cave.cpp:38:13: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   38 |             for (int i=0; i<av.size(); i++) cout<<av[i]; cout<<endl;
      |             ^~~
cave.cpp:38:58: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   38 |             for (int i=0; i<av.size(); i++) cout<<av[i]; cout<<endl;
      |                                                          ^~~~
#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...