0_0_20612912_3014.cpp:4:25: error: stray '#' in program
using namespace std;#define L 1000100int a[L],b[L],p[L];long long min(long long x,long long y){ if (x<y) return x; return y;}int main(){ int T; int cas=1; scanf("%d",&T); while(T--) { int n; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); int len=1; b[len]=a[1]; for(int i=2;i<=n;i++) if(a[i]!=a[i-1]) b[++len]=a[i]; p[1]=0; for(int i=2;i<=len;i++) p[i]=b[i]-b[i-1]; long long sum=0,ans=0; for(int i=2;i<=len;i++) { if(p[i]*sum<0) ans+=min(abs(sum),abs(p[i])); sum+=p[i]; } sum=abs(sum); ans+=sum; printf("Case %d: %I64d %I64d\n",cas++,ans,sum+1); } return 0;}
^
0_0_20612912_3014.cpp:4:26: error: 'define' does not name a type
using namespace std;#define L 1000100int a[L],b[L],p[L];long long min(long long x,long long y){ if (x<y) return x; return y;}int main(){ int T; int cas=1; scanf("%d",&T); while(T--) { int n; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); int len=1; b[len]=a[1]; for(int i=2;i<=n;i++) if(a[i]!=a[i-1]) b[++len]=a[i]; p[1]=0; for(int i=2;i<=len;i++) p[i]=b[i]-b[i-1]; long long sum=0,ans=0; for(int i=2;i<=len;i++) { if(p[i]*sum<0) ans+=min(abs(sum),abs(p[i])); sum+=p[i]; } sum=abs(sum); ans+=sum; printf("Case %d: %I64d %I64d\n",cas++,ans,sum+1); } return 0;}
^
0_0_20612912_3014.cpp: In function 'int main()':
0_0_20612912_3014.cpp:4:289: error: 'a' was not declared in this scope
using namespace std;#define L 1000100int a[L],b[L],p[L];long long min(long long x,long long y){ if (x<y) return x; return y;}int main(){ int T; int cas=1; scanf("%d",&T); while(T--) { int n; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); int len=1; b[len]=a[1]; for(int i=2;i<=n;i++) if(a[i]!=a[i-1]) b[++len]=a[i]; p[1]=0; for(int i=2;i<=len;i++) p[i]=b[i]-b[i-1]; long long sum=0,ans=0; for(int i=2;i<=len;i++) { if(p[i]*sum<0) ans+=min(abs(sum),abs(p[i])); sum+=p[i]; } sum=abs(sum); ans+=sum; printf("Case %d: %I64d %I64d\n",cas++,ans,sum+1); } return 0;}
^
0_0_20612912_3014.cpp:4:322: error: 'b' was not declared in this scope
using namespace std;#define L 1000100int a[L],b[L],p[L];long long min(long long x,long long y){ if (x<y) return x; return y;}int main(){ int T; int cas=1; scanf("%d",&T); while(T--) { int n; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); int len=1; b[len]=a[1]; for(int i=2;i<=n;i++) if(a[i]!=a[i-1]) b[++len]=a[i]; p[1]=0; for(int i=2;i<=len;i++) p[i]=b[i]-b[i-1]; long long sum=0,ans=0; for(int i=2;i<=len;i++) { if(p[i]*sum<0) ans+=min(abs(sum),abs(p[i])); sum+=p[i]; } sum=abs(sum); ans+=sum; printf("Case %d: %I64d %I64d\n",cas++,ans,sum+1); } return 0;}
^
0_0_20612912_3014.cpp:4:329: error: 'a' was not declared in this scope
using namespace std;#define L 1000100int a[L],b[L],p[L];long long min(long long x,long long y){ if (x<y) return x; return y;}int main(){ int T; int cas=1; scanf("%d",&T); while(T--) { int n; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); int len=1; b[len]=a[1]; for(int i=2;i<=n;i++) if(a[i]!=a[i-1]) b[++len]=a[i]; p[1]=0; for(int i=2;i<=len;i++) p[i]=b[i]-b[i-1]; long long sum=0,ans=0; for(int i=2;i<=len;i++) { if(p[i]*sum<0) ans+=min(abs(sum),abs(p[i])); sum+=p[i]; } sum=abs(sum); ans+=sum; printf("Case %d: %I64d %I64d\n",cas++,ans,sum+1); } return 0;}
^
0_0_20612912_3014.cpp:4:406: error: 'p' was not declared in this scope
using namespace std;#define L 1000100int a[L],b[L],p[L];long long min(long long x,long long y){ if (x<y) return x; return y;}int main(){ int T; int cas=1; scanf("%d",&T); while(T--) { int n; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); int len=1; b[len]=a[1]; for(int i=2;i<=n;i++) if(a[i]!=a[i-1]) b[++len]=a[i]; p[1]=0; for(int i=2;i<=len;i++) p[i]=b[i]-b[i-1]; long long sum=0,ans=0; for(int i=2;i<=len;i++) { if(p[i]*sum<0) ans+=min(abs(sum),abs(p[i])); sum+=p[i]; } sum=abs(sum); ans+=sum; printf("Case %d: %I64d %I64d\n",cas++,ans,sum+1); } return 0;}
^
|