Submission #993139

#TimeUsernameProblemLanguageResultExecution timeMemory
993139RifalCave (IOI13_cave)C++14
0 / 100
1511 ms600 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] = {}; int x = tryCombination(now); int cnt = 1; for(int i = 0; i < N; i++) { int l = 0, r = N-1; for(int j = 0; j < N; j++) { if(S[j] == -1) now[j] = -1; else now[j] = S[j]; } // cout << x << ' ' << i << 'a' << endl; if(i == x) { while(l < r) { int mid = (l+r)/2; vector<int> v; for(int j = 0; j <= N; j++) { if(now[j] == -1 && j >= l && j <= mid) { v.push_back(j); now[j] = 1; } else if(now[j] == -1) { v.push_back(j); now[j] = 0; } } cnt++; // for(int j = 0; j < N; j++) cout << now[j] << ' '; int y = tryCombination(now); // cout << y << 'o' << endl; x = tryCombination(now); // cout << endl; // cout << l << ' ' << mid << ' ' << r << ' ' << x << 'b' << endl; 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 = 0; j <= N; j++) { if(now[j] == -1 && j >= l && j <= mid) { v.push_back(j); now[j] = 1; } else if(now[j] == -1) { v.push_back(j); now[j] = 0; } } cnt++; x = tryCombination(now); // cout << l << ' ' << mid << ' ' << r << ' ' << x << 'c' << endl; 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:45:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |             for(int j = 0; j < v.size(); j++) {
      |                            ~~^~~~~~~~~~
cave.cpp:34:17: warning: unused variable 'y' [-Wunused-variable]
   34 |             int y = tryCombination(now);
      |                 ^
cave.cpp:75:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   75 |             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...