Submission #136372

#TimeUsernameProblemLanguageResultExecution timeMemory
136372aintaMeandian (CEOI06_meandian)C++17
100 / 100
8 ms376 KiB
#include "libmean.h" #include<cstdio> #include<algorithm> using namespace std; int arr[100]; int Go(int *w) { int i, T[5], j; for (i = 0; i < 5; i++) { T[i] = Meandian(w[(i + 1) % 5], w[(i + 2) % 5], w[(i + 3) % 5], w[(i + 4) % 5]); } int pv; for (i = 0; i < 5; i++) { for (j = 0; j < 5; j++) { if (i != j && T[i] == T[j])break; } if (j == 5)pv = i; } sort(T, T + 5); arr[w[pv]-1] = T[1] + T[3] - T[2]; return w[pv]; } int main(void) { int i, n; int foo, bar, quux; n = Init(); for (i = 0; i < n; i++)arr[i] = -1; int w[5]; for (i = 1; i <= 4; i++)w[i - 1] = i; int pv = 4; for (i = 5; i <= n; i++) { w[pv] = i; int z = Go(w); for (int j = 0; j < 5; j++)if (w[j] == z)pv = j; } Solution(arr); }

Compilation message (stderr)

meandian.cpp: In function 'int main()':
meandian.cpp:27:6: warning: unused variable 'foo' [-Wunused-variable]
  int foo, bar, quux;
      ^~~
meandian.cpp:27:11: warning: unused variable 'bar' [-Wunused-variable]
  int foo, bar, quux;
           ^~~
meandian.cpp:27:16: warning: unused variable 'quux' [-Wunused-variable]
  int foo, bar, quux;
                ^~~~
meandian.cpp: In function 'int Go(int*)':
meandian.cpp:20:10: warning: 'pv' may be used uninitialized in this function [-Wmaybe-uninitialized]
  arr[w[pv]-1] = T[1] + T[3] - T[2];
          ^
#Verdict Execution timeMemoryGrader output
Fetching results...