Submission #1216710

#TimeUsernameProblemLanguageResultExecution timeMemory
1216710lizi14Boxes with souvenirs (IOI15_boxes)C++20
Compilation error
0 ms0 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; long long delivery(int N, int K, int L, int p[]) { int x[L]; fill(x,x+L,0); for(int i=0; i<n; i++){ cin>>p[i]; x[p[i]]=1; } int ans=0; for(int i=1; i<L; i++){ if(x[i]==1){ ans+=min(i,L-i); } } return (ans*2); }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:7:20: error: 'n' was not declared in this scope
    7 |     for(int i=0; i<n; i++){
      |                    ^