Submission #954449

#TimeUsernameProblemLanguageResultExecution timeMemory
954449__Davit__Cave (IOI13_cave)C++17
13 / 100
9 ms568 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; namespace { int *subtask2(int a[]) { int n = sizeof(a) / sizeof(int); int res[n]; for (int i = 0; i < n; i++) { a[i] ^= 1; int x = tryCombination(a); a[i] ^= 1; res[i] = x; } return res; } } void exploreCave(int N) { int a[N]; for (int i = 0; i < N; i++)a[i] = 0; // for (int i = 0; i < N; i++)b[i] = i; // int x = tryCombination(a); // N = sizeof(a) / sizeof(int); int b[N]; for (int i = 0; i < N; i++) { a[i] ^= 1; int x = tryCombination(a); a[i] ^= 1; b[i] = x; } answer(a, b); }

Compilation message (stderr)

cave.cpp: In function 'int* {anonymous}::subtask2(int*)':
cave.cpp:10:24: warning: 'sizeof' on array function parameter 'a' will return size of 'int*' [-Wsizeof-array-argument]
   10 |         int n = sizeof(a) / sizeof(int);
      |                       ~^~
cave.cpp:9:23: note: declared here
    9 |     int *subtask2(int a[]) {
      |                   ~~~~^~~
cave.cpp:18:16: warning: address of local variable 'res' returned [-Wreturn-local-addr]
   18 |         return res;
      |                ^~~
cave.cpp:11:13: note: declared here
   11 |         int res[n];
      |             ^~~
cave.cpp: At global scope:
cave.cpp:9:10: warning: 'int* {anonymous}::subtask2(int*)' defined but not used [-Wunused-function]
    9 |     int *subtask2(int a[]) {
      |          ^~~~~~~~
#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...