Submission #392460

#TimeUsernameProblemLanguageResultExecution timeMemory
392460my99nBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
1 ms304 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; int cwtour[1000100], cwwtour[1000100]; long long delivery(int N, int K, int L, int p[]) { int dis = 0, h; for (int i = 0; i < N; i++) { dis += p[i]; if (dis >= L/2) h=i; } for (int i = 1; i <= N; i++) cwtour[i] = p[i-1] + cwtour[max(0,i-K)]; for (int i = N; i >= 1; i--) cwwtour[i] = L-p[i-1] + cwwtour[i+K>N?0:i+K]; for (int i = 1; i <= N; i++) cout << cwtour[i] << ' '; cerr << endl; for (int i = 1; i <= N; i++) cout << cwwtour[i] << ' '; cerr << endl; int ans = 1e9; for (int i = 1; i <= N; i++) { if (i+1 <= N) ans = min(ans, 2*cwtour[i]+2*cwwtour[i+1]); if (i+K+1 <= N) ans = min(ans, 2*cwtour[i]+2*cwwtour[i+K+1]+L); } return ans; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:15:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   15 |   for (int i = 1; i <= N; i++) cout << cwtour[i] << ' '; cerr << endl;
      |   ^~~
boxes.cpp:15:58: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   15 |   for (int i = 1; i <= N; i++) cout << cwtour[i] << ' '; cerr << endl;
      |                                                          ^~~~
boxes.cpp:16:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   16 |   for (int i = 1; i <= N; i++) cout << cwwtour[i] << ' '; cerr << endl;
      |   ^~~
boxes.cpp:16:59: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   16 |   for (int i = 1; i <= N; i++) cout << cwwtour[i] << ' '; cerr << endl;
      |                                                           ^~~~
boxes.cpp:7:16: warning: variable 'h' set but not used [-Wunused-but-set-variable]
    7 |   int dis = 0, h;
      |                ^
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...