Submission #131935

#TimeUsernameProblemLanguageResultExecution timeMemory
131935junodeveloperCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h" #include <vector> #include <algorithm> using namespace std; int S[5010], D[5010], rev[5010]; int Try() { return tryCombination(S); } void exploreCave(int N) { memset(D, -1, sizeof(D)); int s = 0, x, B, idx, tmp; while(1) { idx = Try(); if(idx != -1) x = idx - s + 1; else x = N - s; B = sqrt((N - s) / x); vector<int> a; for(int i=0; i<N; i++) { if(D[i] == -1) { a.push_back(i); if(a.size() == B) { for(auto& j : a) S[j] ^= 1; tmp = Try(); if(idx != tmp) { for(auto& j : a) S[j] ^= 1; for(auto& j : a) { S[j] ^= 1; int t = Try(); if(t < idx || idx == -1) { rev[t] = j; D[j] = t; } else if(idx < t) { rev[idx] = j; D[j] = idx; } } for(auto& j : a) S[j] ^= 1; } for(auto& j : a) S[j] ^= 1; a.clear(); } } } } answer(S, D); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:10:2: error: 'memset' was not declared in this scope
  memset(D, -1, sizeof(D));
  ^~~~~~
cave.cpp:10:2: note: suggested alternative: 'fd_set'
  memset(D, -1, sizeof(D));
  ^~~~~~
  fd_set
cave.cpp:16:7: error: 'sqrt' was not declared in this scope
   B = sqrt((N - s) / x);
       ^~~~
cave.cpp:16:7: note: suggested alternative: 'qsort'
   B = sqrt((N - s) / x);
       ^~~~
       qsort
cave.cpp:21:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(a.size() == B) {
        ~~~~~~~~~^~~~