제출 #849818

#제출 시각아이디문제언어결과실행 시간메모리
849818JooDdae동굴 (IOI13_cave)C++17
100 / 100
219 ms848 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { int a[N], b[N], c[N]; for(int i=0;i<N;i++) a[i] = b[i] = c[i] = -1; for(int i=0;i<N;i++) { vector<int> v; for(int j=0;j<N;j++) a[j] = b[j]; for(int j=0;j<N;j++) if(a[j] == -1) { a[j] = 0, v.push_back(j); } int re = tryCombination(a); int flag = (re < 0 || re > i ? 0 : 1); for(int x : v) a[x] = flag; // for(int x : v) { // a[x] = !flag; // re = tryCombination(a); // if(-1 < re && re <= i) { // c[x] = i; // b[x] = a[x] = flag; // break; // } // a[x] = flag; // } while(v.size() > 1) { int mid = v.size()/2; for(int i=0;i<v.size();i++) a[v[i]] = (i < mid) ^ flag; int re = tryCombination(a); for(int i=0;i<v.size();i++) a[v[i]] = flag; if(re == -1 || re > i) v = vector(v.begin()+mid, v.end()); else v = vector(v.begin(), v.begin()+mid); } c[v[0]] = i, b[v[0]] = a[v[0]] = flag; } answer(b, c); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:35:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |             for(int i=0;i<v.size();i++) a[v[i]] = (i < mid) ^ flag;
      |                         ~^~~~~~~~~
cave.cpp:37:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             for(int i=0;i<v.size();i++) a[v[i]] = flag;
      |                         ~^~~~~~~~~
#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...