Submission #1121297

#TimeUsernameProblemLanguageResultExecution timeMemory
1121297PagodePaivaCave (IOI13_cave)C++17
0 / 100
45 ms596 KiB
#include<bits/stdc++.h> #include "cave.h" using namespace std; const int N = 5000; int c[N]; int d[N]; void exploreCave(int n) { int ask[n]; for(int i = 0;i < n;i++){ ask[i] = 0; } int t = tryCombination(ask); vector <int> v; for(int i = 0;i <n;i++){ v.push_back(i); } for(int i = 0;i < n;i++){ int l = 0, r = v.size()-1; while(l < r){ int mid = (l+r)/2; for(int j = l;j <= mid;j++){ ask[v[j]] ^= 1; } int tt = tryCombination(ask); if(t == i and tt == i){ l = mid+1; } else if(t == i and tt != i){ r = mid; } else if(t != i and tt != i){ l = mid+1; } else{ r = mid; } t = tt; } c[i] = v[l]; if(t == i) d[i] = ask[i]; else{ ask[i] ^= 1; d[i] = ask[i]; } vector <int> vv; for(int j = 0;j < v.size();j++){ if(i == v[j]) continue; vv.push_back(v[j]); } v = vv; } int res1[n], res2[n]; for(int i = 0;i < n;i++){ res1[i] = c[i]; res2[i] = d[i]; } answer(res1, res2); return; }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:49:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |         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...