Submission #992898

#TimeUsernameProblemLanguageResultExecution timeMemory
992898RifalCave (IOI13_cave)C++14
0 / 100
3 ms572 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { int now[N] = {}; int S[N]; for(int i = 0; i < N; i++) S[i] = -1; int D[N] = {}; for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) { if(S[j] == -1) now[j] = 0; else now[j] = S[j]; } int l = 0, r = N-1; int x = tryCombination(now); for(int j = 0; j < N; j++) { if(S[j] == -1) now[j] = -1; else now[j] = S[j]; } if(i == x) { while(l <= r) { int mid = (l+r)/2; vector<int> v; for(int j = l; j <= mid; j++) { if(now[j] == -1) { v.push_back(j); now[j] = 1; } } x = tryCombination(now); if(x == i) { l = mid+1; } else { r = mid; } for(int j = 0; j < v.size(); j++) { now[v[j]] = -1; } } S[l] = 0; D[i] = l; } else { while(l <= r) { int mid = (l+r)/2; vector<int> v; for(int j = l; j <= mid; j++) { if(now[j] == -1) { v.push_back(j); now[j] = 1; } } x = tryCombination(now); if(x != i) { l = mid+1; } else { r = mid; } for(int j = 0; j < v.size(); j++) { now[v[j]] = -1; } } S[l] = 1; D[i] = l; } } answer(S,D); }

Compilation message (stderr)

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